summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2016-09-20 11:44:51 -0400
committerJacob Keeler <jacob.keeler@livioradio.com>2016-09-20 14:37:25 -0400
commit039581419749dbdd32590804e8b14a77fcaf9636 (patch)
treeced927fc4bef4686f7373a5f45dd692bd9fc9de0 /src/components/application_manager
parent1b96b7c02d2e338b846a7314c6fa0bdaa31f7c5e (diff)
parentaff7f09a4ec07becfb64dc78992580061d3342ff (diff)
downloadsdl_core-039581419749dbdd32590804e8b14a77fcaf9636.tar.gz
Merge branch 'master'
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/CMakeLists.txt50
-rw-r--r--src/components/application_manager/include/application_manager/application.h1199
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h466
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h245
-rw-r--r--src/components/application_manager/include/application_manager/application_manager.h516
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h813
-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.h27
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h54
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_notification_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h44
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_response_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h11
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h11
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h45
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/get_urls.h75
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h20
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h71
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h (renamed from src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h)27
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h64
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h71
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h73
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h71
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h72
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h36
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h3
-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_phone_call_notification.h)26
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h73
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h36
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h153
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h7
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h98
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h36
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h13
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h10
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h13
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h11
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h15
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h11
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h15
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h35
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_request.h38
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h93
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h344
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h12
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h10
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/generic_response.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h77
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h (renamed from src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h)48
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h10
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h69
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h12
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h82
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h17
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h48
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h14
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h12
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h48
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/show_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/show_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/slider_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/slider_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/speak_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/speak_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h41
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h77
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h72
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/system_request.h12
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/system_response.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h39
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h74
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h72
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h3
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event.h30
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h62
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h129
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_observer.h23
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities.h204
-rw-r--r--src/components/application_manager/include/application_manager/hmi_command_factory.h7
-rw-r--r--src/components/application_manager/include/application_manager/hmi_language_handler.h187
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h390
-rw-r--r--src/components/application_manager/include/application_manager/message.h10
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h1104
-rw-r--r--src/components/application_manager/include/application_manager/mobile_command_factory.h8
-rw-r--r--src/components/application_manager/include/application_manager/mobile_message_handler.h22
-rw-r--r--src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h67
-rw-r--r--src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h80
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_event_observer.h22
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h371
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler_observer.h15
-rw-r--r--src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h8
-rw-r--r--src/components/application_manager/include/application_manager/request_controller.h456
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h610
-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.h506
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h274
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h838
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h235
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h138
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h707
-rw-r--r--src/components/application_manager/include/application_manager/state_context.h75
-rw-r--r--src/components/application_manager/include/application_manager/state_controller.h408
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h448
-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)5
-rw-r--r--src/components/application_manager/include/application_manager/usage_statistics.h21
-rw-r--r--src/components/application_manager/include/application_manager/vehicle_info_data.h8
-rw-r--r--src/components/application_manager/src/application_data_impl.cc163
-rw-r--r--src/components/application_manager/src/application_impl.cc655
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc2212
-rw-r--r--src/components/application_manager/src/application_state.cc249
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc100
-rw-r--r--src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc15
-rw-r--r--src/components/application_manager/src/commands/command_notification_impl.cc15
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc201
-rw-r--r--src/components/application_manager/src/commands/command_response_impl.cc20
-rw-r--r--src/components/application_manager/src/commands/hmi/activate_app_request.cc50
-rw-r--r--src/components/application_manager/src/commands/hmi/activate_app_response.cc14
-rw-r--r--src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_app_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_app_response.cc19
-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/basic_communication_system_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/close_popup_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/close_popup_response.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/dial_number_request.cc14
-rw-r--r--src/components/application_manager/src/commands/hmi/dial_number_response.cc18
-rw-r--r--src/components/application_manager/src/commands/hmi/get_system_info_request.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/get_system_info_response.cc63
-rw-r--r--src/components/application_manager/src/commands/hmi/get_urls.cc64
-rw-r--r--src/components/application_manager/src/commands/hmi/get_urls_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc140
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_get_way_points_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/navi_get_way_points_response.cc (renamed from src/components/application_manager/src/commands/hmi/ui_set_icon_response.cc)24
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_send_location_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_send_location_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc92
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc (renamed from src/components/application_manager/test/mock/src/application_manager_impl.cc)26
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc (renamed from src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc)32
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc53
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc59
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/notification_from_hmi.cc26
-rw-r--r--src/components/application_manager/src/commands/hmi/notification_to_hmi.cc18
-rw-r--r--src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc19
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc76
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc46
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc14
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_button_event_notification.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/on_button_press_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc99
-rw-r--r--src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc28
-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)22
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc30
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc70
-rw-r--r--src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_find_applications.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc57
-rw-r--r--src/components/application_manager/src/commands/hmi/on_policy_update.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_put_file_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ready_notification.cc15
-rw-r--r--src/components/application_manager/src/commands/hmi/on_received_policy_update.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/on_record_start_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_status_update_notification.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_context_notification.cc38
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_error_notification.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_request_notification.cc46
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc34
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc35
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/on_update_device_list.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc42
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc41
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/request_from_hmi.cc69
-rw-r--r--src/components/application_manager/src/commands/hmi/request_to_hmi.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/response_from_hmi.cc29
-rw-r--r--src/components/application_manager/src/commands/hmi/response_to_hmi.cc15
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc239
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc18
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc30
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_policy_update.cc5
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc22
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_language_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_language_response.cc36
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_speak_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_speak_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_command_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_command_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_alert_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_alert_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_language_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_language_response.cc36
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_show_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_show_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_slider_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_slider_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/update_app_list_request.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/update_app_list_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/update_device_list_request.cc24
-rw-r--r--src/components/application_manager/src/commands/hmi/update_device_list_response.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/update_sdl_request.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/update_sdl_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc14
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc17
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_read_did_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_read_did_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_add_command_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_add_command_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc14
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_language_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_language_response.cc37
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc310
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc57
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc161
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc285
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc226
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_response.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc312
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc173
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_file_request.cc47
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_file_response.cc21
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc114
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc66
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc53
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_response.cc14
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc15
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/generic_response.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc168
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_request.cc59
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_response.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/list_files_request.cc58
-rw-r--r--src/components/application_manager/src/commands/mobile/list_files_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc84
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_press_notification.cc84
-rw-r--r--src/components/application_manager/src/commands/mobile/on_command_notification.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc18
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc27
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc54
-rw-r--r--src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc31
-rw-r--r--src/components/application_manager/src/commands/mobile/on_language_change_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc93
-rw-r--r--src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc50
-rw-r--r--src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc61
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc193
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc557
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_response.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/put_file_request.cc142
-rw-r--r--src/components/application_manager/src/commands/mobile/put_file_response.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc47
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc618
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_response.cc47
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc183
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_request.cc59
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_response.cc19
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc214
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_request.cc133
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_request.cc35
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc513
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/set_icon_request.cc44
-rw-r--r--src/components/application_manager/src/commands/mobile/set_icon_response.cc15
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc27
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc101
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc136
-rw-r--r--src/components/application_manager/src/commands/mobile/show_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc93
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_request.cc58
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_response.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_request.cc42
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_response.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc334
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc72
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/system_request.cc231
-rw-r--r--src/components/application_manager/src/commands/mobile/system_response.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc18
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc23
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc332
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc65
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc93
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_response.cc13
-rw-r--r--src/components/application_manager/src/commands/pending.cc8
-rw-r--r--src/components/application_manager/src/event_engine/event.cc16
-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.cc21
-rw-r--r--src/components/application_manager/src/hmi_capabilities.cc722
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc1720
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc352
-rw-r--r--src/components/application_manager/src/hmi_state.cc199
-rw-r--r--src/components/application_manager/src/message.cc29
-rw-r--r--src/components/application_manager/src/message_helper.cc2620
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc2501
-rw-r--r--src/components/application_manager/src/mobile_command_factory.cc499
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc152
-rw-r--r--src/components/application_manager/src/policies/delegates/app_permission_delegate.cc23
-rw-r--r--src/components/application_manager/src/policies/delegates/statistics_delegate.cc144
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc38
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc918
-rw-r--r--src/components/application_manager/src/policies/policy_retry_sequence.cc7
-rw-r--r--src/components/application_manager/src/policies/pt_exchange_handler_ext.cc26
-rw-r--r--src/components/application_manager/src/policies/pt_exchange_handler_impl.cc8
-rw-r--r--src/components/application_manager/src/request_controller.cc342
-rw-r--r--src/components/application_manager/src/request_info.cc148
-rw-r--r--src/components/application_manager/src/resume_ctrl.cpp1311
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl.cc795
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc218
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc2810
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc487
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc981
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc405
-rw-r--r--src/components/application_manager/src/state_context.cc62
-rw-r--r--src/components/application_manager/src/state_controller.cc469
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc966
-rw-r--r--src/components/application_manager/src/usage_statistics.cc67
-rw-r--r--src/components/application_manager/test/CMakeLists.txt186
-rw-r--r--src/components/application_manager/test/application_impl_test.cc732
-rw-r--r--src/components/application_manager/test/application_state_test.cc268
-rw-r--r--src/components/application_manager/test/command_impl_test.cc76
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc124
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc99
-rw-r--r--src/components/application_manager/test/event_engine_test.cc183
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json466
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc527
-rw-r--r--src/components/application_manager/test/include/application_manager/application_manager_mock.h (renamed from src/components/application_manager/test/state_controller/include/application_manager_mock.h)52
-rw-r--r--src/components/application_manager/test/include/application_manager/application_mock.h (renamed from src/components/application_manager/test/state_controller/include/application_mock.h)268
-rw-r--r--src/components/application_manager/test/include/application_manager/event_observer_mock.h58
-rw-r--r--src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h62
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h (renamed from src/components/application_manager/test/resumption/include/application_mock.h)75
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application_manager.h248
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h68
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h174
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data.h95
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_statistics_manager.h (renamed from src/components/application_manager/test/state_controller/include/state_controller_mock.h)51
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h53
-rw-r--r--src/components/application_manager/test/include/application_manager/policy_handler_interface_mock.h203
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_mock.h (renamed from src/components/application_manager/test/resumption/include/resumption_data_mock.h)24
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h (renamed from src/components/application_manager/test/resumption/include/resumption_data_test.h)47
-rw-r--r--src/components/application_manager/test/include/application_manager/statistics_manager_mock.h (renamed from src/components/application_manager/test/state_controller/include/statistics_manager_mock.h)19
-rw-r--r--src/components/application_manager/test/include/application_manager/test_resumption_data_db.h62
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt61
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt.user189
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc906
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc311
-rw-r--r--src/components/application_manager/test/mobile_message_handler_v1_test.cc126
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.h373
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_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
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_message_helper.cc309
-rw-r--r--src/components/application_manager/test/policy_event_observer_test.cc140
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc1478
-rw-r--r--src/components/application_manager/test/request_controller/request_controller_test.cc186
-rw-r--r--src/components/application_manager/test/request_info_test.cc537
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc676
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc134
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc135
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc67
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc3090
-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.txt6
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc2026
-rw-r--r--src/components/application_manager/test/usage_statistics_test.cc174
-rw-r--r--src/components/application_manager/test/zero_request_amount_test.cc169
1177 files changed, 48368 insertions, 21649 deletions
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index e8db4d46c8..d44cf6c69e 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/
@@ -49,21 +49,36 @@ include_directories (
${COMPONENTS_DIR}/rpc_base/include/
${COMPONENTS_DIR}/interfaces
${CMAKE_BINARY_DIR}/src/components/
- ${COMPONENTS_DIR}/include/
- ${COMPONENTS_DIR}/policy/src/policy/include/
- ${COMPONENTS_DIR}/policy/src/policy/usage_statistics/include/
+ ${COMPONENTS_DIR}/policy/include/
${JSONCPP_INCLUDE_DIRECTORY}
${ENCRYPTION_INCLUDE_DIRECTORY}
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${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/usage_statistics.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
@@ -72,11 +87,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/*
@@ -121,8 +139,8 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/on_sdl_persistence_complete_notification.cc
${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_navi_way_point_change_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
@@ -220,6 +238,10 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/navi_show_constant_tbt_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_send_location_request.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_send_location_response.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_subscribe_way_points_request.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_subscribe_way_points_response.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_unsubscribe_way_points_request.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_unsubscribe_way_points_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_ready_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_system_context_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_device_chosen_notification.cc
@@ -232,7 +254,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
@@ -259,6 +280,8 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_start_stream_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_request.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_response.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_request.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_system_request_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_put_file_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_resume_audio_source_notification.cc
@@ -278,9 +301,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
@@ -333,8 +356,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()
@@ -342,16 +370,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
@@ -363,4 +394,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 c0f10d7fba..20a8c9b3b0 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,36 +74,32 @@ 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()
- : is_persistent(false),
- is_download_complete(false),
- file_type(mobile_apis::FileType::INVALID_ENUM) {
- }
- 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){
+ // need to use in std::map;
+ AppFile()
+ : is_persistent(false)
+ , is_download_complete(false)
+ , file_type(mobile_apis::FileType::INVALID_ENUM) {
}
+ 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) {}
std::string file_name;
bool is_persistent;
bool is_download_complete;
@@ -107,26 +107,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 policy_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& policy_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;
};
@@ -164,555 +164,626 @@ 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 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;
+ 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() : app_state_(ApplicationState::kWaitingForRegistration),
- connection_id_(0),
- 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_;}
+ 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(const 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.
+ */
+ virtual bool IsRegistered() const = 0;
+ /**
+ * @brief MarkRegistered allows to mark application as registered.
+ */
+ void MarkRegistered() {
+ app_state_ = kRegistered;
+ }
- /**
- * @brief SetShemaUrl allows to store schema url for application.
- *
- * @param url url to store.
- */
- void SetShemaUrl(const std::string& url) {url_ = url;}
+ /**
+ * @brief MarkUnregistered allows to mark application as unregistered.
+ */
+ void MarkUnregistered() {
+ app_state_ = kWaitingForRegistration;
+ }
- /**
- * @brief packagName allows to obtain application's package name.
- *
- * @return pakage name.
- */
- std::string PackageName() const {return package_name_;}
+ /**
+ * @brief schemaUrl contains application's url (for 4th protocol version)
+ *
+ * @return application's url.
+ */
+ std::string SchemaUrl() const {
+ return url_;
+ }
- /**
- * @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 SetShemaUrl allows to store schema url for application.
+ *
+ * @param url url to store.
+ */
+ void SetShemaUrl(const std::string& url) {
+ url_ = url;
+ }
- /**
- * @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 packagName allows to obtain application's package name.
+ *
+ * @return pakage name.
+ */
+ std::string PackageName() const {
+ return package_name_;
+ }
- /**
- * @brief Returns is application should be greyed out on HMI
- */
- bool is_greyed_out() const {return is_greyed_out_;}
+ /**
+ * @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 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 GetDeviceId allows to obtain device id which posseses
+ * by this application.
+ *
+ * @return device the device id.
+ */
+ std::string GetDeviceId() const {
+ return device_id_;
+ }
- protected:
+ /**
+ * @brief Returns is application should be greyed out on HMI
+ */
+ bool is_greyed_out() const {
+ return is_greyed_out_;
+ }
- /**
- * @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_;
+ /**
+ * @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;
+
+ /**
+ * @brief Get available app space
+ * @param name of the app folder(make + mobile app id)
+ * @return free app space.
+ */
+ virtual uint32_t GetAvailableDiskSpace() = 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..465e4e010a 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
@@ -44,235 +44,244 @@ namespace application_manager {
namespace mobile_api = mobile_apis;
class InitialApplicationDataImpl : public virtual Application {
- public:
- InitialApplicationDataImpl();
- ~InitialApplicationDataImpl();
-
- const smart_objects::SmartObject* app_types() const;
- const smart_objects::SmartObject* vr_synonyms() const;
- virtual std::string mobile_app_id() const;
- const smart_objects::SmartObject* tts_name() const;
- const smart_objects::SmartObject* ngn_media_screen_name() const;
- const mobile_api::Language::eType& language() const;
- const mobile_api::Language::eType& ui_language() const;
- void set_app_types(const smart_objects::SmartObject& app_types);
- void set_vr_synonyms(const smart_objects::SmartObject& vr_synonyms);
- void set_mobile_app_id(const std::string& mobile_app_id);
- void set_tts_name(const smart_objects::SmartObject& tts_name);
- void set_ngn_media_screen_name(const smart_objects::SmartObject& ngn_name);
- void set_language(const mobile_api::Language::eType& language);
- void set_ui_language(const mobile_api::Language::eType& ui_language);
-
- protected:
- smart_objects::SmartObject* app_types_;
- smart_objects::SmartObject* vr_synonyms_;
- std::string mobile_app_id_;
- smart_objects::SmartObject* tts_name_;
- smart_objects::SmartObject* ngn_media_screen_name_;
- mobile_api::Language::eType language_;
- mobile_api::Language::eType ui_language_;
- private:
- DISALLOW_COPY_AND_ASSIGN(InitialApplicationDataImpl);
+ public:
+ InitialApplicationDataImpl();
+ ~InitialApplicationDataImpl();
+
+ const smart_objects::SmartObject* app_types() const;
+ const smart_objects::SmartObject* vr_synonyms() const;
+ virtual std::string policy_app_id() const;
+ const smart_objects::SmartObject* tts_name() const;
+ const smart_objects::SmartObject* ngn_media_screen_name() const;
+ const mobile_api::Language::eType& language() const;
+ const mobile_api::Language::eType& ui_language() const;
+ void set_app_types(const smart_objects::SmartObject& app_types);
+ void set_vr_synonyms(const smart_objects::SmartObject& vr_synonyms);
+ void set_mobile_app_id(const std::string& policy_app_id);
+ void set_tts_name(const smart_objects::SmartObject& tts_name);
+ void set_ngn_media_screen_name(const smart_objects::SmartObject& ngn_name);
+ 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_;
+ std::string mobile_app_id_;
+ smart_objects::SmartObject* tts_name_;
+ 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);
};
class DynamicApplicationDataImpl : public virtual Application {
- public:
- DynamicApplicationDataImpl();
- ~DynamicApplicationDataImpl();
- const smart_objects::SmartObject* help_prompt() const;
- const smart_objects::SmartObject* timeout_prompt() const;
- const smart_objects::SmartObject* vr_help_title() const;
- const smart_objects::SmartObject* vr_help() const;
- const mobile_api::TBTState::eType& tbt_state() const;
- const smart_objects::SmartObject* show_command() const;
- const smart_objects::SmartObject* tbt_show_command() const;
- const smart_objects::SmartObject* keyboard_props() const;
- const smart_objects::SmartObject* menu_title() const;
- const smart_objects::SmartObject* menu_icon() const;
-
- void load_global_properties(const smart_objects::SmartObject& properties_so);
- void set_help_prompt(const smart_objects::SmartObject& help_prompt);
- void set_timeout_prompt(const smart_objects::SmartObject& timeout_prompt);
- void set_vr_help_title(const smart_objects::SmartObject& vr_help_title);
- void reset_vr_help_title();
- void set_vr_help(const smart_objects::SmartObject& vr_help);
- void reset_vr_help();
- void set_tbt_state(const mobile_api::TBTState::eType& tbt_state);
- void set_show_command(const smart_objects::SmartObject& show_command);
- void set_tbt_show_command(const smart_objects::SmartObject& tbt_show);
- void set_keyboard_props(const smart_objects::SmartObject& keyboard_props);
- void set_menu_title(const smart_objects::SmartObject& menu_title);
- void set_menu_icon(const smart_objects::SmartObject& menu_icon);
- /*
- * @brief Adds a command to the in application menu
- */
- void AddCommand(uint32_t cmd_id,
- const smart_objects::SmartObject& command);
-
- /*
- * @brief Deletes all commands from the application menu with the specified command id
- */
- void RemoveCommand(uint32_t cmd_id);
-
- /*
- * @brief Finds command with the specified command id
- */
- smart_objects::SmartObject* FindCommand(uint32_t cmd_id);
-
- /*
- * @brief Adds a menu to the application
- */
- void AddSubMenu(uint32_t menu_id, const smart_objects::SmartObject& menu);
-
- /*
- * @brief Deletes menu from the application menu
- */
- void RemoveSubMenu(uint32_t menu_id);
-
- /*
- * @brief Finds menu with the specified id
- */
- smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const;
-
- /*
- * @brief Returns true if sub menu with such name already exist
- */
- bool IsSubMenuNameAlreadyExist(const std::string& name);
-
- /*
- * @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
- */
- void AddChoiceSet(uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set);
-
- /*
- * @brief Deletes choice set from the application
- *
- * @param choice_set_id Unique ID of the interaction choice set
- */
- void RemoveChoiceSet(uint32_t choice_set_id);
-
- /*
- * @brief Finds choice set with the specified choice_set_id id
- *
- * @param choice_set_id Unique ID of the interaction choice set
- */
- smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id);
-
- /*
- * @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
- */
- void AddPerformInteractionChoiceSet(uint32_t correlation_id,
- uint32_t choice_set_id, const smart_objects::SmartObject& choice_set);
-
- /*
- * @brief Deletes entirely perform interaction choice set map
- * @param correlation_id Unique ID of the request that added this choice set
- *
- */
- void DeletePerformInteractionChoiceSet(uint32_t correlation_id);
-
- /*
- * @brief Retrieves entirely ChoiceSet - VR commands map
- *
- * @return ChoiceSet map that is currently in use
- */
- inline DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map() const;
-
- /*
- * @brief Retrieve application commands
- */
- inline DataAccessor<CommandsMap> commands_map() const;
-
- /*
- * @brief Retrieve application sub menus
- */
- inline DataAccessor<SubMenuMap> sub_menu_map() const;
-
- /*
- * @brief Retrieve application choice set map
- */
- inline DataAccessor<ChoiceSetMap> choice_set_map() const;
-
- /*
- * @brief Sets perform interaction state
- *
- * @param active Current state of the perform interaction
- */
- void set_perform_interaction_active(uint32_t active);
-
- /*
- * @brief Retrieves perform interaction state
- *
- * @return TRUE if perform interaction active, otherwise FALSE
- */
- inline uint32_t is_perform_interaction_active() const;
-
- /*
- * @brief Sets the mode for perform interaction: UI/VR/BOTH
- *
- * @param mode Mode that was selected (MENU; VR; BOTH)
- */
- void set_perform_interaction_mode(int32_t mode);
-
- /*
- * @brief Retrieve the mode that was PerformInteraction sent in
- *
- * @return mode of PerformInteraction
- */
- inline int32_t perform_interaction_mode() const;
-
- /*
- * @brief Sets reset global properties state
- *
- * @param active Current state of the reset global properties
- */
- void set_reset_global_properties_active(bool active);
-
- /*
- * @brief Retrieves reset global properties state
- *
- * @return TRUE if perform interaction active, otherwise FALSE
- */
- inline bool is_reset_global_properties_active() const;
-
-protected:
- smart_objects::SmartObject* help_prompt_;
- smart_objects::SmartObject* timeout_prompt_;
- smart_objects::SmartObject* vr_help_title_;
- smart_objects::SmartObject* vr_help_;
- mobile_api::TBTState::eType tbt_state_;
- smart_objects::SmartObject* show_command_;
- smart_objects::SmartObject* keyboard_props_;
- smart_objects::SmartObject* menu_title_;
- smart_objects::SmartObject* menu_icon_;
- smart_objects::SmartObject* tbt_show_command_;
-
-
- CommandsMap commands_;
- mutable sync_primitives::Lock commands_lock_;
- SubMenuMap sub_menu_;
- mutable sync_primitives::Lock sub_menu_lock_;
- ChoiceSetMap choice_set_map_;
- mutable sync_primitives::Lock choice_set_map_lock_;
- PerformChoiceSetMap performinteraction_choice_set_map_;
- mutable sync_primitives::Lock performinteraction_choice_set_lock_;
- uint32_t is_perform_interaction_active_;
- bool is_reset_global_properties_active_;
- int32_t perform_interaction_mode_;
-
-private:
- void SetGlobalProperties(const smart_objects::SmartObject& param,
- void (DynamicApplicationData::*callback)(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject&));
- DISALLOW_COPY_AND_ASSIGN(DynamicApplicationDataImpl);
+ public:
+ DynamicApplicationDataImpl();
+ ~DynamicApplicationDataImpl();
+ const smart_objects::SmartObject* help_prompt() const;
+ const smart_objects::SmartObject* timeout_prompt() const;
+ const smart_objects::SmartObject* vr_help_title() const;
+ const smart_objects::SmartObject* vr_help() const;
+ const mobile_api::TBTState::eType& tbt_state() const;
+ const smart_objects::SmartObject* show_command() const;
+ const smart_objects::SmartObject* tbt_show_command() const;
+ const smart_objects::SmartObject* keyboard_props() const;
+ const smart_objects::SmartObject* menu_title() const;
+ const smart_objects::SmartObject* menu_icon() const;
+
+ void load_global_properties(const smart_objects::SmartObject& properties_so);
+ void set_help_prompt(const smart_objects::SmartObject& help_prompt);
+ void set_timeout_prompt(const smart_objects::SmartObject& timeout_prompt);
+ void set_vr_help_title(const smart_objects::SmartObject& vr_help_title);
+ void reset_vr_help_title();
+ void set_vr_help(const smart_objects::SmartObject& vr_help);
+ void reset_vr_help();
+ void set_tbt_state(const mobile_api::TBTState::eType& tbt_state);
+ void set_show_command(const smart_objects::SmartObject& show_command);
+ void set_tbt_show_command(const smart_objects::SmartObject& tbt_show);
+ void set_keyboard_props(const smart_objects::SmartObject& keyboard_props);
+ void set_menu_title(const smart_objects::SmartObject& menu_title);
+ void set_menu_icon(const smart_objects::SmartObject& menu_icon);
+ /*
+ * @brief Adds a command to the in application menu
+ */
+ void AddCommand(uint32_t cmd_id, const smart_objects::SmartObject& command);
+
+ /*
+ * @brief Deletes all commands from the application menu with the specified
+ * command id
+ */
+ void RemoveCommand(uint32_t cmd_id);
+
+ /*
+ * @brief Finds command with the specified command id
+ */
+ smart_objects::SmartObject* FindCommand(uint32_t cmd_id);
+
+ /*
+ * @brief Adds a menu to the application
+ */
+ void AddSubMenu(uint32_t menu_id, const smart_objects::SmartObject& menu);
+
+ /*
+ * @brief Deletes menu from the application menu
+ */
+ void RemoveSubMenu(uint32_t menu_id);
+
+ /*
+ * @brief Finds menu with the specified id
+ */
+ smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const;
+
+ /*
+ * @brief Returns true if sub menu with such name already exist
+ */
+ bool IsSubMenuNameAlreadyExist(const std::string& name);
+
+ /*
+ * @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
+ */
+ void AddChoiceSet(uint32_t choice_set_id,
+ const smart_objects::SmartObject& choice_set);
+
+ /*
+ * @brief Deletes choice set from the application
+ *
+ * @param choice_set_id Unique ID of the interaction choice set
+ */
+ void RemoveChoiceSet(uint32_t choice_set_id);
+
+ /*
+ * @brief Finds choice set with the specified choice_set_id id
+ *
+ * @param choice_set_id Unique ID of the interaction choice set
+ */
+ smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id);
+
+ /*
+ * @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
+ */
+ void AddPerformInteractionChoiceSet(
+ uint32_t correlation_id,
+ uint32_t choice_set_id,
+ const smart_objects::SmartObject& choice_set);
+
+ /*
+ * @brief Deletes entirely perform interaction choice set map
+ * @param correlation_id Unique ID of the request that added this choice set
+ *
+ */
+ void DeletePerformInteractionChoiceSet(uint32_t correlation_id);
+
+ /*
+ * @brief Retrieves entirely ChoiceSet - VR commands map
+ *
+ * @return ChoiceSet map that is currently in use
+ */
+ inline DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map()
+ const;
+
+ /*
+ * @brief Retrieve application commands
+ */
+ inline DataAccessor<CommandsMap> commands_map() const;
+
+ /*
+ * @brief Retrieve application sub menus
+ */
+ inline DataAccessor<SubMenuMap> sub_menu_map() const;
+
+ /*
+ * @brief Retrieve application choice set map
+ */
+ inline DataAccessor<ChoiceSetMap> choice_set_map() const;
+
+ /*
+ * @brief Sets perform interaction state
+ *
+ * @param active Current state of the perform interaction
+ */
+ void set_perform_interaction_active(uint32_t active);
+
+ /*
+ * @brief Retrieves perform interaction state
+ *
+ * @return TRUE if perform interaction active, otherwise FALSE
+ */
+ inline uint32_t is_perform_interaction_active() const;
+
+ /*
+ * @brief Sets the mode for perform interaction: UI/VR/BOTH
+ *
+ * @param mode Mode that was selected (MENU; VR; BOTH)
+ */
+ void set_perform_interaction_mode(int32_t mode);
+
+ /*
+ * @brief Retrieve the mode that was PerformInteraction sent in
+ *
+ * @return mode of PerformInteraction
+ */
+ inline int32_t perform_interaction_mode() const;
+
+ /*
+ * @brief Sets reset global properties state
+ *
+ * @param active Current state of the reset global properties
+ */
+ void set_reset_global_properties_active(bool active);
+
+ /*
+ * @brief Retrieves reset global properties state
+ *
+ * @return TRUE if perform interaction active, otherwise FALSE
+ */
+ inline bool is_reset_global_properties_active() const;
+
+ protected:
+ smart_objects::SmartObject* help_prompt_;
+ smart_objects::SmartObject* timeout_prompt_;
+ smart_objects::SmartObject* vr_help_title_;
+ smart_objects::SmartObject* vr_help_;
+ mobile_api::TBTState::eType tbt_state_;
+ smart_objects::SmartObject* show_command_;
+ smart_objects::SmartObject* keyboard_props_;
+ smart_objects::SmartObject* menu_title_;
+ smart_objects::SmartObject* menu_icon_;
+ smart_objects::SmartObject* tbt_show_command_;
+
+ CommandsMap commands_;
+ mutable sync_primitives::Lock commands_lock_;
+ SubMenuMap sub_menu_;
+ mutable sync_primitives::Lock sub_menu_lock_;
+ ChoiceSetMap choice_set_map_;
+ mutable sync_primitives::Lock choice_set_map_lock_;
+ PerformChoiceSetMap performinteraction_choice_set_map_;
+ mutable sync_primitives::Lock performinteraction_choice_set_lock_;
+ uint32_t is_perform_interaction_active_;
+ bool is_reset_global_properties_active_;
+ int32_t perform_interaction_mode_;
+
+ private:
+ void SetGlobalProperties(
+ const smart_objects::SmartObject& param,
+ void (DynamicApplicationData::*callback)(
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject&));
+ DISALLOW_COPY_AND_ASSIGN(DynamicApplicationDataImpl);
};
DataAccessor<CommandsMap> DynamicApplicationDataImpl::commands_map() const {
@@ -289,9 +298,8 @@ DataAccessor<ChoiceSetMap> DynamicApplicationDataImpl::choice_set_map() const {
DataAccessor<PerformChoiceSetMap>
DynamicApplicationDataImpl::performinteraction_choice_set_map() const {
- return DataAccessor<PerformChoiceSetMap>(
- performinteraction_choice_set_map_,
- performinteraction_choice_set_lock_);
+ return DataAccessor<PerformChoiceSetMap>(performinteraction_choice_set_map_,
+ performinteraction_choice_set_lock_);
}
uint32_t DynamicApplicationDataImpl::is_perform_interaction_active() const {
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..75496b2761 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -38,6 +38,7 @@
#include <vector>
#include <utility>
#include <list>
+#include <stdint.h>
#include "utils/date_time.h"
#include "application_manager/application_data_impl.h"
@@ -46,8 +47,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 +62,18 @@ 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& policy_app_id,
+ const std::string& mac_address,
+ const custom_str::CustomString& app_name,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ ApplicationManager& application_manager);
~ApplicationImpl();
@@ -84,7 +91,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;
@@ -97,15 +106,11 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
bool audio_streaming_allowed() const;
void set_audio_streaming_allowed(bool state);
- void StartStreaming(
- protocol_handler::ServiceType service_type);
- void StopStreaming(
- protocol_handler::ServiceType service_type);
-
- void SuspendStreaming(
- protocol_handler::ServiceType service_type);
- void WakeUpStreaming(
- protocol_handler::ServiceType service_type);
+ void 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(protocol_handler::ServiceType service_type);
virtual bool is_voice_communication_supported() const;
virtual void set_voice_communication_supported(
@@ -118,43 +123,46 @@ 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;
- virtual void set_foreground(bool is_foreground);
- virtual const mobile_api::HMILevel::eType hmi_level() const;
+ bool is_foreground() const OVERRIDE;
+ void set_foreground(const bool is_foreground) OVERRIDE;
+ const mobile_apis::HMILevel::eType hmi_level() const;
const uint32_t put_file_in_none_count() const;
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();
void increment_list_files_in_none_count();
bool set_app_icon_path(const std::string& path);
- void set_app_allowed(const bool& allowed);
+ void set_app_allowed(const bool allowed);
void set_device(connection_handler::DeviceHandle device);
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,24 +172,29 @@ 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;
+ inline bool IsRegistered() 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;
- /**
- * @brief Change Hash for current application
- * and send notification to mobile
- * @return updated_hash
- */
+#ifdef CUSTOMER_PASA
+ virtual bool flag_sending_hash_change_after_awake() const;
+ virtual void set_flag_sending_hash_change_after_awake(bool flag);
+#endif // CUSTOMER_PASA
+ /**
+ * @brief Change Hash for current application
+ * and send notification to mobile
+ * @return updated_hash
+ */
virtual void UpdateHash();
UsageStatistics& usage_report();
@@ -194,20 +207,36 @@ 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 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 +268,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,21 +284,25 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
void set_video_stream_retry_number(const uint32_t& video_stream_retry_number);
- protected:
+ /**
+ * @brief Load persistent files from application folder.
+ */
+ void LoadPersistentFiles() OVERRIDE;
/**
- * @brief Clean up application folder. Persistent files will stay
+ * @brief Get available app space
+ * @param name of the app folder(make + mobile app id)
+ * @return free app space.
*/
- void CleanupFiles();
+ uint32_t GetAvailableDiskSpace() OVERRIDE;
+ protected:
/**
- * @brief Load persistent files from application folder.
+ * @brief Clean up application folder. Persistent files will stay
*/
- void LoadPersistentFiles();
+ void CleanupFiles();
private:
- typedef SharedPtr<TimerThread<ApplicationImpl>> ApplicationTimerPtr;
-
/**
* @brief Callback for video streaming suspend timer.
* Suspends video streaming process for application
@@ -269,55 +310,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 +382,20 @@ 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_;
+ ApplicationManager& application_manager_;
DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
};
@@ -354,14 +411,18 @@ 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 {
return is_app_allowed_;
}
+bool ApplicationImpl::IsRegistered() const {
+ return app_state_ == kRegistered;
+}
+
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_IMPL_H_
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 b535b5b63d..97c38cd134 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,7 +33,28 @@
#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 "vehicle_info_data.h"
#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/commands/command.h"
+#include "connection_handler/connection_handler.h"
+#include "utils/data_accessor.h"
+#include "utils/shared_ptr.h"
+#include "telemetry_monitor/telemetry_observable.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/state_controller.h"
+
+namespace resumption {
+class LastState;
+}
+
+namespace media_manager {
+class MediaManager;
+}
// Other compomnents class declaration
namespace hmi_message_handler {
@@ -45,19 +66,58 @@ class ProtocolHandler;
namespace connection_handler {
class ConnectionHandler;
}
+namespace resumption {
+class ResumeCtrl;
+}
namespace application_manager {
+namespace event_engine {
+class EventDispatcher;
+}
+
class Application;
+class StateControllerImpl;
+struct CommandParametersPermissions;
+typedef std::vector<std::string> RPCParams;
+
+struct ApplicationsAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) const {
+ return lhs->app_id() < rhs->app_id();
+ }
+};
+
+struct ApplicationsPolicyAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) {
+ if (lhs->policy_app_id() == rhs->policy_app_id()) {
+ return lhs->device() < rhs->device();
+ }
+ return lhs->policy_app_id() < rhs->policy_app_id();
+ }
+};
+
+typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplicationSet;
+
+typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
+ AppsWaitRegistrationSet;
+
+// typedef for Applications list iterator
+typedef ApplicationSet::iterator ApplicationSetIt;
+
+// typedef for Applications list const iterator
+typedef ApplicationSet::const_iterator ApplicationSetConstIt;
class ApplicationManager {
-public:
+ public:
virtual ~ApplicationManager() {}
/**
* Inits application manager
*/
- virtual bool Init() = 0;
+ virtual bool Init(resumption::LastState& last_state,
+ media_manager::MediaManager* media_manager) = 0;
/**
* @brief Stop work.
@@ -66,12 +126,164 @@ public:
**/
virtual bool Stop() = 0;
- virtual void
- set_hmi_message_handler(hmi_message_handler::HMIMessageHandler *handler) = 0;
- virtual void
- set_protocol_handler(protocol_handler::ProtocolHandler *handler) = 0;
- virtual void
- set_connection_handler(connection_handler::ConnectionHandler *handler) = 0;
+ virtual void set_hmi_message_handler(
+ hmi_message_handler::HMIMessageHandler* handler) = 0;
+ virtual void set_protocol_handler(
+ protocol_handler::ProtocolHandler* handler) = 0;
+ 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 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;
+
+ /**
+ * @brief Checks if Application is subscribed for way points
+ * @param Application AppID
+ * @return true if Application is subscribed for way points
+ * otherwise false
+ */
+ virtual bool IsAppSubscribedForWayPoints(const uint32_t app_id) const = 0;
+
+ /**
+ * @brief Subscribe Application for way points
+ * @param Application AppID
+ */
+ virtual void SubscribeAppForWayPoints(const uint32_t app_id) = 0;
+
+ /**
+ * @brief Unsubscribe Application for way points
+ * @param Application AppID
+ */
+ virtual void UnsubscribeAppFromWayPoints(const uint32_t app_id) = 0;
+
+ /**
+ * @brief Is Any Application is subscribed for way points
+ * @return true if some app is subscribed otherwise false
+ */
+ virtual bool IsAnyAppSubscribedForWayPoints() const = 0;
+
+ /**
+ * @brief Get subscribed for way points
+ * @return reference to set of subscribed apps for way points
+ */
+ virtual const std::set<int32_t> GetAppsSubscribedForWayPoints() const = 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 const HMICapabilities& hmi_capabilities() const = 0;
+
+ virtual void ProcessQueryApp(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key) = 0;
+
+ virtual bool is_attenuated_supported() const = 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
@@ -79,8 +291,290 @@ public:
* @param app Application
*/
virtual void OnApplicationRegistered(ApplicationSharedPtr app) = 0;
+
+ virtual connection_handler::ConnectionHandler& connection_handler() const = 0;
+ virtual protocol_handler::ProtocolHandler& protocol_handler() const = 0;
+ virtual policy::PolicyHandlerInterface& GetPolicyHandler() = 0;
+
+ virtual uint32_t GetNextHMICorrelationID() = 0;
+ virtual uint32_t GenerateNewHMIAppID() = 0;
+
+ /**
+ * @brief Ends opened navi services (audio/video) for application
+ * @param app_id Application id
+ */
+ virtual void EndNaviServices(uint32_t app_id) = 0;
+
+ /* @brief Starts audio passthru process
+ *
+ * @return true on success, false if passthru is already in process
+ */
+ virtual bool BeginAudioPassThrough() = 0;
+
+ /*
+ * @brief Finishes already started audio passthru process
+ *
+ * @return true on success, false if passthru is not active
+ */
+ virtual bool EndAudioPassThrough() = 0;
+
+ virtual void ConnectToDevice(const std::string& device_mac) = 0;
+
+ virtual void OnHMIStartedCooperation() = 0;
+
+ virtual bool IsHMICooperating() const = 0;
+ /**
+ * @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
+ */
+ virtual std::vector<ApplicationSharedPtr> IviInfoUpdated(
+ VehicleDataType vehicle_info, int value) = 0;
+
+ virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
+ smart_objects::SmartObject>& request_for_registration) = 0;
+
+ virtual void SendUpdateAppList() = 0;
+
+ virtual void MarkAppsGreyOut(const connection_handler::DeviceHandle handle,
+ bool is_greyed_out) = 0;
+
+ /**
+ * @brief Returns pointer to application-to-be-registered (from QUERY_APP
+ * list)
+ * @param hmi_id HMI application id
+ * @return Pointer to application or uninitialized shared pointer
+ */
+ virtual ApplicationConstSharedPtr WaitingApplicationByID(
+ const uint32_t hmi_id) const = 0;
+
+ /**
+ * @brief Returns list of applications-to-be-registered (QUERY_APP list)
+ * @return Locked list of applications
+ */
+ virtual DataAccessor<AppsWaitRegistrationSet> AppsWaitingForRegistration()
+ const = 0;
+
+ virtual bool IsAppsQueriedFrom(
+ const connection_handler::DeviceHandle handle) const = 0;
+
+ virtual bool IsStopping() const = 0;
+
+ virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0;
+
+ virtual 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) = 0;
+ /*
+ * @brief Sets SDL access to all mobile apps
+ *
+ * @param allowed SDL access to all mobile apps
+ */
+ virtual void SetAllAppsAllowed(const bool allowed) = 0;
+
+ /*
+ * @brief Sets state for driver distraction
+ *
+ * @param state New state to be set
+ */
+ virtual void set_driver_distraction(bool is_distracting) = 0;
+
+ /*
+ * @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
+ */
+ virtual 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) = 0;
+
+ virtual void StartDevicesDiscovery() = 0;
+
+ virtual void StopAudioPassThru(int32_t application_key) = 0;
+
+ /**
+ * @brief TerminateRequest forces termination of request
+ * @param connection_key - application id of request
+ * @param corr_id correlation id of request
+ */
+ virtual void TerminateRequest(uint32_t connection_key, uint32_t corr_id) = 0;
+
+ /*
+ * @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)
+ */
+ virtual void UnregisterApplication(const uint32_t& app_id,
+ mobile_apis::Result::eType reason,
+ bool is_resuming = false,
+ bool is_unexpected_disconnect = false) = 0;
+
+ /**
+ * @ 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
+ */
+ virtual void updateRequestTimeout(uint32_t connection_key,
+ uint32_t mobile_correlation_id,
+ uint32_t new_timeout_value) = 0;
+
+ virtual StateController& state_controller() = 0;
+
+ virtual void SetUnregisterAllApplicationsReason(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0;
+
+ /*
+ * @brief Called on Master_reset or Factory_defaults
+ * when User chooses to reset HU.
+ * Resets Policy Table if applicable.
+ */
+ virtual void HeadUnitReset(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0;
+
+ /**
+ * @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
+ */
+ virtual bool HMILevelAllowsStreaming(
+ uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
+
+ /**
+ * @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
+ */
+ virtual 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) = 0;
+
+ /**
+ * @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 policy_app_id application's mobile(policy) identifier.
+ *
+ * @return true in case application is allowed to register, false otherwise.
+ */
+ virtual bool IsApplicationForbidden(
+ uint32_t connection_key, const std::string& policy_app_id) const = 0;
+
+ virtual resumption::ResumeCtrl& resume_controller() = 0;
+ /*
+ * @brief Converts connection string transport type representation
+ * to HMI Common_TransportType
+ *
+ * @param transport_type String representing connection type
+ *
+ * @return Corresponding HMI TransporType value
+ */
+ virtual hmi_apis::Common_TransportType::eType GetDeviceTransportType(
+ const std::string& transport_type) = 0;
+
+ /**
+ * @brief method adds application
+ * to tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ virtual void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) = 0;
+
+ /**
+ * Generate grammar ID
+ *
+ * @return New grammar ID
+ */
+ virtual uint32_t GenerateGrammarID() = 0;
+
+ virtual policy::DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Handle sequence for unauthorized application
+ * @param app_id Application id
+ */
+ virtual void OnAppUnauthorized(const uint32_t& app_id) = 0;
+
+ virtual bool ActivateApplication(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @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
+ */
+ virtual void OnAppStreaming(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state) = 0;
+
+ /**
+ * @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
+ */
+ virtual 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 = 0;
+
+ virtual void SendAudioPassThroughNotification(
+ uint32_t session_key, std::vector<uint8_t>& binary_data) = 0;
+
+ /**
+ * @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
+ */
+ virtual bool CanAppStream(
+ uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
+
+ /**
+ * @brief ForbidStreaming forbid the stream over the certain application.
+ * @param app_id the application's id which should stop streaming.
+ */
+ virtual void ForbidStreaming(uint32_t app_id) = 0;
+
+ virtual const ApplicationManagerSettings& get_settings() const = 0;
+
+ virtual event_engine::EventDispatcher& event_dispatcher() = 0;
};
-} // namespace application_manager
+} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
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 a5b9833954..dda192f8b0 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,19 +46,22 @@
#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 "application_manager/state_controller_impl.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/event_engine/event_dispatcher_impl.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.h"
#include "connection_handler/connection_handler_observer.h"
#include "connection_handler/device.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
+#include "policies/policy_handler.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
@@ -66,9 +69,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"
@@ -77,8 +86,8 @@
#include "utils/threads/thread.h"
#include "utils/threads/message_loop_thread.h"
#include "utils/lock.h"
-#include "utils/singleton.h"
#include "utils/data_accessor.h"
+#include "utils/timer.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -96,12 +105,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 };
struct CommandParametersPermissions;
+typedef std::map<std::string, hmi_apis::Common_TransportType::eType>
+ DeviceTypes;
namespace impl {
using namespace threads;
@@ -117,44 +129,56 @@ using namespace threads;
* when we have them.
*/
struct MessageFromMobile : public utils::SharedPtr<Message> {
- explicit MessageFromMobile(const utils::SharedPtr<Message> &message)
+ MessageFromMobile() {}
+ explicit MessageFromMobile(const 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(); }
+ size_t PriorityOrder() const {
+ return (*this)->Priority().OrderingValue();
+ }
};
struct MessageToMobile : public utils::SharedPtr<Message> {
- explicit MessageToMobile(const utils::SharedPtr<Message> &message,
+ MessageToMobile() : is_final(false) {}
+ explicit MessageToMobile(const utils::SharedPtr<Message>& message,
bool 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(); }
+ size_t PriorityOrder() const {
+ return (*this)->Priority().OrderingValue();
+ }
// Signals if connection to mobile must be closed after sending this message
bool is_final;
};
struct MessageFromHmi : public utils::SharedPtr<Message> {
- explicit MessageFromHmi(const utils::SharedPtr<Message> &message)
+ MessageFromHmi() {}
+ explicit MessageFromHmi(const 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(); }
+ size_t PriorityOrder() const {
+ return (*this)->Priority().OrderingValue();
+ }
};
struct MessageToHmi : public utils::SharedPtr<Message> {
- explicit MessageToHmi(const utils::SharedPtr<Message> &message)
+ MessageToHmi() {}
+ explicit MessageToHmi(const 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(); }
+ size_t PriorityOrder() const {
+ return (*this)->Priority().OrderingValue();
+ }
};
// Short type names for prioritized message queues
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile>>
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile> >
FromMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile>>
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> >
ToMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi>>
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> >
FromHmiQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi>>
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> >
ToHmiQueue;
// AudioPassThru
@@ -165,8 +189,9 @@ typedef struct {
typedef std::queue<AudioData> RawAudioDataQueue;
typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue;
}
-
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
typedef std::vector<std::string> RPCParams;
+typedef utils::SharedPtr<timer::Timer> TimerSPtr;
class ApplicationManagerImpl
: public ApplicationManager,
@@ -174,66 +199,69 @@ class ApplicationManagerImpl
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,
- public utils::Singleton<ApplicationManagerImpl> {
+ public impl::AudioPassThruQueue::Handler
+#ifdef TELEMETRY_MONITOR
+ ,
+ public telemetry_monitor::TelemetryObservable<AMTelemetryObserver>
+#endif // TELEMETRY_MONITOR
+ {
friend class ResumeCtrl;
friend class CommandImpl;
-public:
+ public:
+ ApplicationManagerImpl(const ApplicationManagerSettings& am_settings,
+ const policy::PolicySettings& policy_settings);
~ApplicationManagerImpl();
/**
* Inits application manager
*/
- virtual bool Init();
+ bool Init(resumption::LastState& last_state,
+ media_manager::MediaManager* media_manager) OVERRIDE;
/**
* @brief Stop work.
*
* @return TRUE on success otherwise FALSE.
**/
- virtual bool Stop();
+ bool Stop() OVERRIDE;
- /////////////////////////////////////////////////////
+ DataAccessor<ApplicationSet> applications() const OVERRIDE;
+ ApplicationSharedPtr application(uint32_t app_id) 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();
+ ApplicationSharedPtr active_application() const OVERRIDE;
- /**
- * @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;
+ ApplicationSharedPtr application_by_hmi_app(
+ uint32_t hmi_app_id) const OVERRIDE;
+ ApplicationSharedPtr application_by_policy_id(
+ const std::string& policy_app_id) const OVERRIDE;
- /**
- * @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;
+ std::vector<ApplicationSharedPtr> applications_by_button(
+ uint32_t button) OVERRIDE;
+ std::vector<ApplicationSharedPtr> applications_with_navi() OVERRIDE;
- /**
- * @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;
+ ApplicationSharedPtr get_limited_media_application() const OVERRIDE;
+ ApplicationSharedPtr get_limited_navi_application() const OVERRIDE;
+ ApplicationSharedPtr get_limited_voice_application() const OVERRIDE;
+
+ uint32_t application_id(const int32_t correlation_id) OVERRIDE;
+ void set_application_id(const int32_t correlation_id,
+ const uint32_t app_id) OVERRIDE;
+ void OnHMILevelChanged(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to) OVERRIDE;
+
+ void SendHMIStatusNotification(
+ const utils::SharedPtr<Application> app) OVERRIDE;
/**
* @brief Checks if application with the same HMI type
* (media, voice communication or navi) exists
@@ -243,7 +271,39 @@ public:
*
* @return true if exist otherwise false
*/
- bool IsAppTypeExistsInFullOrLimited(ApplicationSharedPtr app) const;
+ bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const;
+
+ /**
+ * @brief Checks if Application is subscribed for way points
+ * @param Application AppID
+ * @return true if Application is subscribed for way points
+ * otherwise false
+ */
+ bool IsAppSubscribedForWayPoints(const uint32_t app_id) const OVERRIDE;
+
+ /**
+ * @brief Subscribe Application for way points
+ * @param Application AppID
+ */
+ void SubscribeAppForWayPoints(const uint32_t app_id) OVERRIDE;
+
+ /**
+ * @brief Unsubscribe Application for way points
+ * @param Application AppID
+ */
+ void UnsubscribeAppFromWayPoints(const uint32_t app_id) OVERRIDE;
+
+ /**
+ * @brief Is Any Application is subscribed for way points
+ * @return true if some app is subscribed otherwise false
+ */
+ bool IsAnyAppSubscribedForWayPoints() const OVERRIDE;
+
+ /**
+ * @brief Get subscribed for way points
+ * @return reference to set of subscribed apps for way points
+ */
+ const std::set<int32_t> GetAppsSubscribedForWayPoints() const OVERRIDE;
/**
* @brief Notifies all components interested in Vehicle Data update
@@ -253,13 +313,12 @@ public:
* @param new value (for integer values currently) of vehicle data
*/
std::vector<ApplicationSharedPtr> IviInfoUpdated(VehicleDataType vehicle_info,
- int value);
+ int value) OVERRIDE;
void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE;
- /////////////////////////////////////////////////////
-
- HMICapabilities &hmi_capabilities();
+ HMICapabilities& hmi_capabilities();
+ const HMICapabilities& hmi_capabilities() const;
/**
* @brief ProcessQueryApp executes logic related to QUERY_APP system request.
@@ -268,21 +327,22 @@ public:
* 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);
+ void ProcessQueryApp(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key) OVERRIDE;
-#ifdef TIME_TESTER
+ bool is_attenuated_supported() const OVERRIDE;
+
+#ifdef TELEMETRY_MONITOR
/**
* @brief Setup observer for time metric.
*
* @param observer - pointer to observer
*/
- void SetTimeMetricObserver(AMMetricObserver *observer);
-#endif // TIME_TESTER
+ void SetTelemetryObserver(AMTelemetryObserver* observer) OVERRIDE;
+#endif // TELEMETRY_MONITOR
- ApplicationSharedPtr
- RegisterApplication(const utils::SharedPtr<smart_objects::SmartObject> &
- request_for_registration);
+ ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
+ smart_objects::SmartObject>& request_for_registration) OVERRIDE;
/*
* @brief Closes application by id
*
@@ -293,16 +353,16 @@ public:
* @param is_unexpected_disconnect
* Indicates if connection was unexpectedly lost(TM layer, HB)
*/
- void UnregisterApplication(const uint32_t &app_id,
+ void UnregisterApplication(const uint32_t& app_id,
mobile_apis::Result::eType reason,
bool is_resuming = false,
- bool is_unexpected_disconnect = false);
+ bool is_unexpected_disconnect = false) OVERRIDE;
/**
* @brief Handle sequence for unauthorized application
* @param app_id Application id
*/
- void OnAppUnauthorized(const uint32_t &app_id);
+ void OnAppUnauthorized(const uint32_t& app_id) OVERRIDE;
/*
* @brief Sets unregister reason for closing all registered applications
@@ -311,14 +371,15 @@ public:
* @param reason Describes the reason for HU switching off
*/
void SetUnregisterAllApplicationsReason(
- mobile_api::AppInterfaceUnregisteredReason::eType reason);
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) OVERRIDE;
/*
* @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);
+ void HeadUnitReset(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) OVERRIDE;
/*
* @brief Closes all registered applications
@@ -327,7 +388,7 @@ public:
bool RemoveAppDataFromHMI(ApplicationSharedPtr app);
bool LoadAppDataToHMI(ApplicationSharedPtr app);
- bool ActivateApplication(ApplicationSharedPtr app);
+ bool ActivateApplication(ApplicationSharedPtr app) OVERRIDE;
/**
* @brief Put application in FULL HMI Level if possible,
@@ -338,28 +399,28 @@ public:
*/
mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app);
- void ConnectToDevice(const std::string &device_mac);
- void OnHMIStartedCooperation();
+ void ConnectToDevice(const std::string& device_mac) OVERRIDE;
+ void OnHMIStartedCooperation() OVERRIDE;
/*
* @brief Returns unique correlation ID for HMI request
*
* @return Unique correlation ID
*/
- uint32_t GetNextHMICorrelationID();
+ uint32_t GetNextHMICorrelationID() OVERRIDE;
/* @brief Starts audio passthru process
*
* @return true on success, false if passthru is already in process
*/
- bool begin_audio_pass_thru();
+ bool BeginAudioPassThrough() OVERRIDE;
/*
* @brief Finishes already started audio passthru process
*
* @return true on success, false if passthru is not active
*/
- bool end_audio_pass_thru();
+ bool EndAudioPassThrough() OVERRIDE;
/*
* @brief Retrieves driver distraction state
@@ -373,7 +434,7 @@ public:
*
* @param state New state to be set
*/
- void set_driver_distraction(bool is_distracting);
+ void set_driver_distraction(const bool is_distracting) OVERRIDE;
/*
* @brief Retrieves if VR session has started
@@ -387,7 +448,7 @@ public:
*
* @param state Current HMI VR session state
*/
- void set_vr_session_started(const bool &state);
+ void set_vr_session_started(const bool state);
/*
* @brief Retrieves SDL access to all mobile apps
@@ -401,7 +462,7 @@ public:
*
* @param allowed SDL access to all mobile apps
*/
- void set_all_apps_allowed(const bool &allowed);
+ void SetAllAppsAllowed(const bool allowed) OVERRIDE;
/**
* @brief CreateRegularState create regular HMI state for application
@@ -411,10 +472,11 @@ public:
* @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;
+ 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 OVERRIDE;
/**
* @brief SetState set regular audio state
@@ -425,15 +487,15 @@ public:
mobile_apis::AudioStreamingState::eType audio_state) {
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID=" << app_id
- << " does not exist");
+ 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
+ * @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
@@ -442,11 +504,11 @@ public:
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");
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
return;
}
- state_ctrl_.SetRegularState<SendActivateApp>(app, new_state);
+ state_ctrl_.SetRegularState(app, new_state, SendActivateApp);
}
/**
@@ -458,11 +520,11 @@ public:
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");
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
return;
}
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level);
+ state_ctrl_.SetRegularState(app, hmi_level, SendActivateApp);
}
/**
@@ -473,15 +535,16 @@ public:
* @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,
+ 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");
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
return;
}
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state);
+ state_ctrl_.SetRegularState(app, hmi_level, audio_state, SendActivateApp);
}
/**
@@ -492,17 +555,18 @@ public:
* @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,
+ 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");
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
return;
}
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state,
- system_context);
+ state_ctrl_.SetRegularState(
+ app, hmi_level, audio_state, system_context, SendActivateApp);
}
/**
@@ -514,14 +578,51 @@ public:
mobile_apis::SystemContext::eType system_context) {
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID=" << app_id
- << " does not exist");
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
return;
}
state_ctrl_.SetRegularState(app, system_context);
}
/**
+ * @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);
+ }
+
+ /**
+ * @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 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:
@@ -533,8 +634,8 @@ public:
* 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);
+ void OnUpdateHMIAppType(
+ std::map<std::string, std::vector<std::string> > app_hmi_types) OVERRIDE;
/*
* @brief Starts audio pass thru thread
@@ -546,16 +647,19 @@ public:
* @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);
+ 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) OVERRIDE;
/*
* @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);
+ void StopAudioPassThru(int32_t application_key) OVERRIDE;
/*
* @brief Creates AudioPassThru data chunk and inserts it
@@ -566,8 +670,8 @@ public:
*
* @param binary_data AudioPassThru data chunk
*/
- void SendAudioPassThroughNotification(uint32_t session_key,
- std::vector<uint8_t> &binary_data);
+ void SendAudioPassThroughNotification(
+ uint32_t session_key, std::vector<uint8_t>& binary_data) OVERRIDE;
std::string GetDeviceName(connection_handler::DeviceHandle handle);
@@ -579,16 +683,12 @@ public:
*
* @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);
+ 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();
@@ -596,48 +696,58 @@ public:
// 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);
+ bool final_message = false) OVERRIDE;
+
+ void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE;
+
+ bool ManageMobileCommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandOrigin origin) OVERRIDE;
+ bool ManageHMICommand(const commands::MessageSharedPtr message) 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);
- void SendMessageToHMI(const commands::MessageSharedPtr message);
- bool ManageHMICommand(const commands::MessageSharedPtr message);
-
- /////////////////////////////////////////////////////////
+ void TerminateRequest(uint32_t connection_key, uint32_t corr_id) OVERRIDE;
// Overriden ProtocolObserver method
- virtual void
- OnMessageReceived(const ::protocol_handler::RawMessagePtr message) OVERRIDE;
- virtual void
- OnMobileMessageSent(const ::protocol_handler::RawMessagePtr message) OVERRIDE;
+ 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;
+ 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
+ const connection_handler::DeviceMap& device_list) OVERRIDE;
void OnFindNewApplicationsRequest() OVERRIDE;
- void
- RemoveDevice(const connection_handler::DeviceHandle &device_handle) 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;
+ 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;
+ 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
@@ -651,7 +761,7 @@ public:
*
* @param ptr Reference to shared pointer that point on hmi notification
*/
- void removeNotification(const commands::Command *notification);
+ void removeNotification(const commands::Command* notification);
/**
* @ Updates request timeout
@@ -662,24 +772,7 @@ public:
*/
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);
+ uint32_t new_timeout_value) OVERRIDE;
/**
* @brief AddPolicyObserver allows to subscribe needed component to events
@@ -687,14 +780,14 @@ public:
*
* @param listener the component to subscribe.
*/
- void AddPolicyObserver(PolicyHandlerObserver *listener);
+ void AddPolicyObserver(PolicyHandlerObserver* listener);
/**
* @brief RemovePolicyObserver allows to remove observer from collection.
*
* @param listener observer to remove.
*/
- void RemovePolicyObserver(PolicyHandlerObserver *listener);
+ void RemovePolicyObserver(PolicyHandlerObserver* listener);
/**
* @brief Checks HMI level and returns true if streaming is allowed
@@ -702,9 +795,9 @@ public:
* @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;
+ bool HMILevelAllowsStreaming(
+ uint32_t app_id,
+ protocol_handler::ServiceType service_type) const OVERRIDE;
/**
* @brief Checks if application can stream (streaming service is started and
@@ -714,19 +807,19 @@ public:
* @return True if streaming is allowed, false in other case
*/
bool CanAppStream(uint32_t app_id,
- protocol_handler::ServiceType service_type) const;
+ protocol_handler::ServiceType service_type) const OVERRIDE;
/**
* @brief Ends opened navi services (audio/video) for application
* @param app_id Application id
*/
- void EndNaviServices(uint32_t app_id);
+ void EndNaviServices(uint32_t app_id) OVERRIDE;
/**
* @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);
+ void ForbidStreaming(uint32_t app_id) OVERRIDE;
/**
* @brief Callback calls when application starts/stops data streaming
@@ -735,56 +828,47 @@ public:
* @param state Shows if streaming started or stopped
*/
void OnAppStreaming(uint32_t app_id,
- protocol_handler::ServiceType service_type, bool state);
+ protocol_handler::ServiceType service_type,
+ bool state) OVERRIDE;
- /**
- * @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;
+ mobile_api::HMILevel::eType GetDefaultHmiLevel(
+ ApplicationConstSharedPtr application) const;
/**
- * Getter for resume_controller
- * @return Resume Controller
- */
- ResumeCtrl &resume_controller() { return resume_ctrl_; }
+ * Getter for resume_controller
+ * @return Resume Controller
+ */
+ resumption::ResumeCtrl& resume_controller() OVERRIDE {
+ return resume_ctrl_;
+ }
/**
* Generate grammar ID
*
* @return New grammar ID
*/
- uint32_t GenerateGrammarID();
+ uint32_t GenerateGrammarID() OVERRIDE;
/**
* Generate new HMI application ID
*
* @return New HMI application ID
*/
- uint32_t GenerateNewHMIAppID();
+ uint32_t GenerateNewHMIAppID() OVERRIDE;
/**
* @brief Parse smartObject and replace mobile app Id by HMI app ID
*
* @param message Smartobject to be parsed
*/
- void ReplaceMobileByHMIAppId(smart_objects::SmartObject &message);
+ 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);
+ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message);
/*
* @brief Save binary data to specified directory
@@ -798,22 +882,22 @@ public:
*
* @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);
+ 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) OVERRIDE;
/**
* @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);
+ uint32_t GetAvailableSpaceForApp(const std::string& folder_name);
/*
* @brief returns true if HMI is cooperating
*/
- bool IsHMICooperating() const;
+ bool IsHMICooperating() const OVERRIDE;
/**
* @brief Method used to send default app tts globalProperties
@@ -827,7 +911,7 @@ public:
* @param app_id contains application which will
* send TTS global properties after timeout
*/
- void AddAppToTTSGlobalPropertiesList(const uint32_t app_id);
+ void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE;
/**
* @brief method removes application
@@ -835,7 +919,7 @@ public:
* @param app_id contains application which will
* send TTS global properties after timeout
*/
- void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id);
+ void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE;
/**
* @brief method adds application in FULL and LIMITED state
@@ -851,16 +935,13 @@ public:
*/
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();
+ connection_handler::ConnectionHandler& connection_handler() const OVERRIDE;
+ protocol_handler::ProtocolHandler& protocol_handler() const OVERRIDE;
+ virtual policy::PolicyHandlerInterface& GetPolicyHandler() OVERRIDE {
+ return policy_handler_;
+ }
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
@@ -872,9 +953,11 @@ public:
* @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);
+ 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) OVERRIDE;
/*
* @brief Function Should be called when Low Voltage is occured
*/
@@ -885,6 +968,22 @@ public:
*/
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 policy_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& policy_app_id) const OVERRIDE;
+
+ policy::DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const OVERRIDE;
+
struct ApplicationsAppIdSorter {
bool operator()(const ApplicationSharedPtr lhs,
const ApplicationSharedPtr rhs) {
@@ -892,95 +991,8 @@ public:
}
};
- 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;
-
- /**
- * Class for thread-safe access to 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(); }
-
- ApplictionSetConstIt begin() { return applications().begin(); }
-
- ApplictionSetConstIt 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>
- 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;
- }
-
- 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);
- }
-
- bool Empty() {
- return ApplicationManagerImpl::instance()->applications_.empty();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ApplicationListAccessor);
- };
-
- friend class ApplicationListAccessor;
+ typedef std::set<std::string> ForbiddenApps;
struct AppIdPredicate {
uint32_t app_id_;
@@ -998,12 +1010,12 @@ public:
}
};
- struct MobileAppIdPredicate {
+ struct PolicyAppIdPredicate {
std::string policy_app_id_;
- MobileAppIdPredicate(const std::string &policy_app_id)
+ PolicyAppIdPredicate(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;
+ return app ? policy_app_id_ == app->policy_app_id() : false;
}
};
@@ -1046,10 +1058,18 @@ public:
}
};
+ struct GrammarIdPredicate {
+ uint32_t grammar_id_;
+ GrammarIdPredicate(uint32_t grammar_id) : grammar_id_(grammar_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? grammar_id_ == app->get_grammar_id() : false;
+ }
+ };
+
/**
* @brief Sends UpdateAppList notification to HMI
*/
- void SendUpdateAppList();
+ void SendUpdateAppList() OVERRIDE;
/**
* @brief Marks applications received through QueryApps as should be
@@ -1058,18 +1078,31 @@ public:
* @param handle, device handle
*/
void MarkAppsGreyOut(const connection_handler::DeviceHandle handle,
- bool is_greyed_out);
+ bool is_greyed_out) OVERRIDE;
+
+ ApplicationConstSharedPtr WaitingApplicationByID(
+ const uint32_t hmi_id) const OVERRIDE;
+
+ DataAccessor<AppsWaitRegistrationSet> AppsWaitingForRegistration()
+ const OVERRIDE;
/**
* @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 IsAppsQueriedFrom(
+ const connection_handler::DeviceHandle handle) const OVERRIDE;
- bool IsStopping() const { return is_stopping_; }
+ bool IsStopping() const OVERRIDE {
+ return is_stopping_;
+ }
+
+ StateController& state_controller() OVERRIDE;
+ const ApplicationManagerSettings& get_settings() const OVERRIDE;
+ virtual event_engine::EventDispatcher& event_dispatcher() OVERRIDE;
-private:
+ private:
/**
* @brief PullLanguagesInfo allows to pull information about languages.
*
@@ -1078,11 +1111,9 @@ private:
* @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();
+ void PullLanguagesInfo(const smart_objects::SmartObject& app_data,
+ smart_objects::SmartObject& ttsName,
+ smart_objects::SmartObject& vrSynonym);
/**
* @brief Method transforms string to AppHMIType
@@ -1097,18 +1128,18 @@ private:
* @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);
+ 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();
+ 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);
+ 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);
@@ -1119,26 +1150,27 @@ private:
* of messages. Beware, each is called on different thread!
*/
// CALLED ON messages_from_mobile_ thread!
- virtual void Handle(const impl::MessageFromMobile message) OVERRIDE;
+ void Handle(const impl::MessageFromMobile message) OVERRIDE;
// CALLED ON messages_to_mobile_ thread!
- virtual void Handle(const impl::MessageToMobile message) OVERRIDE;
+ void Handle(const impl::MessageToMobile message) OVERRIDE;
// CALLED ON messages_from_hmi_ thread!
- virtual void Handle(const impl::MessageFromHmi message) OVERRIDE;
+ void Handle(const impl::MessageFromHmi message) OVERRIDE;
// CALLED ON messages_to_hmi_ thread!
- virtual void Handle(const impl::MessageToHmi message) OVERRIDE;
+ void Handle(const impl::MessageToHmi message) OVERRIDE;
// CALLED ON audio_pass_thru_messages_ thread!
- virtual void Handle(const impl::AudioData message) OVERRIDE;
+ 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::SmartObject& applications,
+ ApplicationManager& app_mngr) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager");
- smart_objects::SmartArray *app_array = applications.asArray();
+ 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) {
@@ -1148,8 +1180,13 @@ private:
}
smart_objects::SmartObject hmi_application(smart_objects::SmartType_Map);
- ;
- if (MessageHelper::CreateHMIApplicationStruct(*it, hmi_application)) {
+ const protocol_handler::SessionObserver& session_observer =
+ connection_handler().get_session_observer();
+ if (MessageHelper::CreateHMIApplicationStruct(*it,
+ session_observer,
+ GetPolicyHandler(),
+ &hmi_application,
+ app_mngr)) {
applications[app_count++] = hmi_application;
} else {
LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct ");
@@ -1172,7 +1209,7 @@ private:
* @param connection_key connection key of app, which provided app list to
* be created
*/
- void CreateApplications(smart_objects::SmartArray &obj_array,
+ void CreateApplications(smart_objects::SmartArray& obj_array,
const uint32_t connection_key);
/*
@@ -1186,17 +1223,28 @@ private:
*/
bool IsLowVoltage();
-private:
+ 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 std::map<uint32_t, std::pair<bool, bool> > NaviServiceStatusMap;
- typedef SharedPtr<TimerThread<ApplicationManagerImpl>>
- ApplicationManagerTimerPtr;
+ /**
+ * @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 policy_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& policy_app_id) const;
/**
* @brief Removes suspended and stopped timers from timer pool
@@ -1275,7 +1323,7 @@ private:
* @param type Directory type
* @return true, if succedeed, otherwise - false
*/
- bool InitDirectory(const std::string &path, DirectoryType type) const;
+ bool InitDirectory(const std::string& path, DirectoryType type) const;
/**
* @brief Checks, whether r/w permissions are present for particular path
@@ -1283,7 +1331,7 @@ private:
* @param type Directory type
* @return true, if allowed, otherwise - false
*/
- bool IsReadWriteAllowed(const std::string &path, DirectoryType type) const;
+ bool IsReadWriteAllowed(const std::string& path, DirectoryType type) const;
/**
* @brief Removes apps, waiting for registration related to
@@ -1293,21 +1341,21 @@ private:
void RemoveAppsWaitingForRegistration(
const connection_handler::DeviceHandle handle);
- /**
- * @brief Clears TTS global properties list of apps
- */
void ClearTTSGlobalPropertiesList();
-private:
+ private:
+ const ApplicationManagerSettings& settings_;
/**
* @brief List of applications
*/
- ApplictionSet 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_;
+ mutable sync_primitives::Lock subscribed_way_points_apps_lock_;
/**
* @brief Map of correlation id and associated application id.
@@ -1315,6 +1363,11 @@ private:
std::map<const int32_t, const uint32_t> appID_list_;
/**
+ * @brief Set AppIDs of subscribed apps for way points
+ */
+ std::set<int32_t> subscribed_way_points_apps_list_;
+
+ /**
* @brief Map contains applications which
* will send TTS global properties to HMI after timeout
*/
@@ -1327,15 +1380,18 @@ private:
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_;
+ event_engine::EventDispatcherImpl event_dispatcher_;
+ media_manager::MediaManager* media_manager_;
+
+ hmi_message_handler::HMIMessageHandler* hmi_handler_;
+ connection_handler::ConnectionHandler* connection_handler_;
+ policy::PolicyHandler policy_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_;
+ 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_;
@@ -1362,7 +1418,7 @@ private:
* about persistent application data on disk, and save session ID for resuming
* application in case INGITION_OFF or MASTER_RESSET
*/
- ResumeCtrl resume_ctrl_;
+ resumption::ResumeCtrl resume_ctrl_;
NaviServiceStatusMap navi_service_status_;
std::deque<uint32_t> navi_app_to_stop_;
@@ -1370,36 +1426,24 @@ private:
uint32_t navi_close_app_timeout_;
uint32_t navi_end_stream_timeout_;
- std::vector<ApplicationManagerTimerPtr> timer_pool_;
+ std::vector<TimerSPtr> timer_pool_;
sync_primitives::Lock timer_pool_lock_;
- sync_primitives::Lock stopping_flag_lock_;
+ sync_primitives::Lock stopping_application_mng_lock_;
+ StateControllerImpl state_ctrl_;
- StateController state_ctrl_;
+#ifdef TELEMETRY_MONITOR
+ AMTelemetryObserver* metric_observer_;
+#endif // TELEMETRY_MONITOR
-#ifdef TIME_TESTER
- AMMetricObserver *metric_observer_;
-#endif // TIME_TESTER
+ Timer application_list_update_timer_;
- 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_;
+ 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 {
@@ -1413,6 +1457,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_
+} // 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.h b/src/components/application_manager/include/application_manager/commands/command.h
index 238e0b71c7..fb2bc6d78f 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -32,17 +32,11 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
-
-#include "utils/shared_ptr.h"
+#include <stdint.h>
#include "smart_objects/smart_object.h"
-#include "application_manager/event_engine/event_observer.h"
-#include "application_manager/smart_object_keys.h"
+#include "utils/shared_ptr.h"
namespace application_manager {
-/**
- * @brief SmartObject type
- **/
-
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
namespace commands {
@@ -114,21 +108,16 @@ class Command {
*/
virtual bool AllowedToTerminate() = 0;
- /**
- * @brief SetAllowedToTerminate set up allowed to terminate flag.
- * If true, request controller will terminate request on response
- */
- virtual void SetAllowedToTerminate(bool allowed) = 0;
-
+ /**
+ * @brief SetAllowedToTerminate set up allowed to terminate flag.
+ * If true, request controller will terminate request on response
+ */
+ virtual void SetAllowedToTerminate(const bool allowed) = 0;
- enum CommandOrigin {
- ORIGIN_SDL,
- ORIGIN_MOBILE
- };
+ enum CommandOrigin { ORIGIN_SDL, ORIGIN_MOBILE };
};
typedef smart_objects::SmartObjectSPtr MessageSharedPtr;
-
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index 6cc8f82330..439b1756ef 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -34,6 +34,9 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_IMPL_H_
#include "application_manager/commands/command.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/smart_object_keys.h"
#include "utils/logger.h"
namespace application_manager {
@@ -49,7 +52,6 @@ struct CommandParametersPermissions {
};
namespace commands {
-
/**
* @brief Class is intended to encapsulate RPC as an object
**/
@@ -60,7 +62,8 @@ class CommandImpl : public Command {
*
* @param message Incoming SmartObject message
**/
- explicit CommandImpl(const MessageSharedPtr& message);
+ CommandImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief CommandImpl class destructor
@@ -71,52 +74,51 @@ class CommandImpl : public Command {
/**
* @brief Checks command permissions according to policy table
*/
- virtual bool CheckPermissions();
+ bool CheckPermissions() OVERRIDE;
/**
* @brief Init required by command resources
**/
- virtual bool Init();
+ bool Init() OVERRIDE;
/**
* @brief Cleanup all resources used by command
**/
- virtual bool CleanUp();
+ bool CleanUp() OVERRIDE;
/**
* @brief Execute corresponding command by calling the action on reciever
**/
- virtual void Run();
-
+ void Run() OVERRIDE;
/**
* @brief Retrieves request default timeout.
* If request has a custom timeout, request_timeout_ should be reassign to it
*
* @return Request default timeout
*/
- virtual uint32_t default_timeout() const;
+ uint32_t default_timeout() const OVERRIDE;
/*
* @brief Retrieves correlation ID
*/
- virtual uint32_t correlation_id() const;
+ uint32_t correlation_id() const OVERRIDE;
/*
* @brief Retrieves connection key
*/
- virtual uint32_t connection_key() const;
+ uint32_t connection_key() const OVERRIDE;
/*
* @brief Retrieves request ID
*/
- virtual int32_t function_id() const;
+ int32_t function_id() const OVERRIDE;
/*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
*/
- virtual void onTimeOut();
+ void onTimeOut() OVERRIDE;
/**
* @brief AllowedToTerminate tells request Controller if it can terminate this
@@ -125,30 +127,42 @@ class CommandImpl : public Command {
* If request need to terminate itself, it should override this function false
* @return allowed_to_terminate_ value
*/
- virtual bool AllowedToTerminate() {
- return allowed_to_terminate_;
- }
+ bool AllowedToTerminate() OVERRIDE;
/**
* @brief SetAllowedToTerminate set up allowed to terminate flag.
* If true, request controller will terminate request on response
*/
- virtual void SetAllowedToTerminate(bool allowed) {
- allowed_to_terminate_ = allowed;
- }
+ void SetAllowedToTerminate(const bool allowed) OVERRIDE;
// members
static const int32_t hmi_protocol_type_;
static const int32_t mobile_protocol_type_;
- static const int32_t protocol_version_;
+ static const int32_t protocol_version_;
protected:
+ /**
+ * @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);
+
MessageSharedPtr message_;
uint32_t default_timeout_;
bool allowed_to_terminate_;
+ ApplicationManager& application_manager_;
+
#ifdef ENABLE_LOG
static log4cxx::LoggerPtr logger_;
-#endif // ENABLE_LOG
+#endif // ENABLE_LOG
private:
DISALLOW_COPY_AND_ASSIGN(CommandImpl);
diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
index 9f95a52850..2f3b809274 100644
--- a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
@@ -47,12 +47,14 @@ namespace commands {
class CommandNotificationFromMobileImpl : public CommandImpl {
public:
- explicit CommandNotificationFromMobileImpl(const MessageSharedPtr& message);
+ CommandNotificationFromMobileImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~CommandNotificationFromMobileImpl();
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
void SendNotification();
+
private:
DISALLOW_COPY_AND_ASSIGN(CommandNotificationFromMobileImpl);
};
diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
index 7d0d11af89..25a2a18aca 100644
--- a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
@@ -47,12 +47,14 @@ namespace commands {
class CommandNotificationImpl : public CommandImpl {
public:
- explicit CommandNotificationImpl(const MessageSharedPtr& message);
+ CommandNotificationImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~CommandNotificationImpl();
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
void SendNotification();
+
private:
DISALLOW_COPY_AND_ASSIGN(CommandNotificationImpl);
};
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..c5f45e2095 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,15 @@ 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);
+ CommandRequestImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~CommandRequestImpl();
virtual bool CheckPermissions();
- virtual bool Init();
+ virtual bool Init();
virtual bool CleanUp();
virtual void Run();
@@ -99,7 +95,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 +106,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 +127,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
@@ -141,10 +136,8 @@ protected:
/**
* @brief Remove from current message parameters disallowed by policy table
- * @param params_permissions Parameters permissions from policy table
*/
- void RemoveDisallowedParameters(
- const CommandParametersPermissions& params_permissions);
+ void RemoveDisallowedParameters();
/**
* @brief Adds disallowed parameters back to response with appropriate
@@ -161,14 +154,20 @@ protected:
bool HasDisallowedParams() const;
protected:
- RequestState current_state_;
- sync_primitives::Lock state_lock_;
- CommandParametersPermissions parameters_permissions_;
+ /**
+ * @brief Returns policy parameters permissions
+ * @return Parameters permissions struct reference
+ */
+ const CommandParametersPermissions& parameters_permissions() const;
+
+ RequestState current_state_;
+ sync_primitives::Lock state_lock_;
+ CommandParametersPermissions parameters_permissions_;
+ CommandParametersPermissions removed_parameters_permissions_;
private:
DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl);
-
/**
* @brief Adds param to disallowed parameters enumeration
* @param info string with disallowed params enumeration
@@ -181,7 +180,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/command_response_impl.h b/src/components/application_manager/include/application_manager/commands/command_response_impl.h
index 0c93bf54d4..2b52ea5a58 100644
--- a/src/components/application_manager/include/application_manager/commands/command_response_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_response_impl.h
@@ -48,7 +48,8 @@ namespace commands {
class CommandResponseImpl : public CommandImpl {
public:
- explicit CommandResponseImpl(const MessageSharedPtr& message);
+ CommandResponseImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~CommandResponseImpl();
virtual bool Init();
virtual bool CleanUp();
@@ -57,6 +58,7 @@ class CommandResponseImpl : public CommandImpl {
const mobile_apis::Result::eType& result_code =
mobile_apis::Result::INVALID_ENUM,
bool final_message = false);
+
private:
DISALLOW_COPY_AND_ASSIGN(CommandResponseImpl);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h
index 5122a0856b..090a77b9ed 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief ActivateAppRequest command class
**/
class ActivateAppRequest : public RequestToHMI {
- public:
- /**
- * @brief ActivateAppRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit ActivateAppRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief ActivateAppRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ActivateAppRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief ActivateAppRequest class destructor
- **/
- virtual ~ActivateAppRequest();
+ /**
+ * @brief ActivateAppRequest class destructor
+ **/
+ virtual ~ActivateAppRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(ActivateAppRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ActivateAppRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h
index a15d317077..471de1135e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief ActivateAppResponse command class
**/
class ActivateAppResponse : public ResponseFromHMI {
- public:
- /**
- * @brief ActivateAppResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit ActivateAppResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief ActivateAppResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ActivateAppResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief ActivateAppResponse class destructor
- **/
- virtual ~ActivateAppResponse();
+ /**
+ * @brief ActivateAppResponse class destructor
+ **/
+ virtual ~ActivateAppResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(ActivateAppResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ActivateAppResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h
index 1aa3b7a512..3e0f81f167 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h
@@ -49,7 +49,8 @@ class AddStatisticsInfoNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AddStatisticsInfoNotification(const MessageSharedPtr& message);
+ AddStatisticsInfoNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AddStatisticsInfoNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h
index 3d42b6d5a6..c1c5b36e5b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h
@@ -49,7 +49,8 @@ class AllowAllAppsRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AllowAllAppsRequest(const MessageSharedPtr& message);
+ AllowAllAppsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AllowAllAppsRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h
index ccc8d5ae7d..711825cfab 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h
@@ -49,7 +49,8 @@ class AllowAllAppsResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AllowAllAppsResponse(const MessageSharedPtr& message);
+ AllowAllAppsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AllowAllAppsResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h
index e90576a7df..10424a2661 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h
@@ -49,7 +49,8 @@ class AllowAppRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AllowAppRequest(const MessageSharedPtr& message);
+ AllowAppRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AllowAppRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h
index 6bedf30a38..4f2642f550 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h
@@ -49,7 +49,8 @@ class AllowAppResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AllowAppResponse(const MessageSharedPtr& message);
+ AllowAppResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AllowAppResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h
index 867596f189..d9aaff7797 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief BasicCommunicationSystemRequest command class
**/
class BasicCommunicationSystemRequest : public RequestToHMI {
- public:
- /**
- * @brief BasicCommunicationSystemRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit BasicCommunicationSystemRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief BasicCommunicationSystemRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationSystemRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief BasicCommunicationSystemRequest class destructor
- **/
- virtual ~BasicCommunicationSystemRequest();
+ /**
+ * @brief BasicCommunicationSystemRequest class destructor
+ **/
+ virtual ~BasicCommunicationSystemRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h
index 5c174eac85..b7d4f8f689 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief BasicCommunicationSystemResponse command class
**/
class BasicCommunicationSystemResponse : public ResponseFromHMI {
- public:
- /**
- * @brief BasicCommunicationSystemResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit BasicCommunicationSystemResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief BasicCommunicationSystemResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationSystemResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief BasicCommunicationSystemResponse class destructor
- **/
- virtual ~BasicCommunicationSystemResponse();
+ /**
+ * @brief BasicCommunicationSystemResponse class destructor
+ **/
+ virtual ~BasicCommunicationSystemResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h
index 639800a047..45dc690c6c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h
@@ -49,7 +49,8 @@ class ButtonGetCapabilitiesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit ButtonGetCapabilitiesRequest(const MessageSharedPtr& message);
+ ButtonGetCapabilitiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ButtonGetCapabilitiesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h
index 7cd174477b..4efa576079 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h
@@ -49,7 +49,8 @@ class ButtonGetCapabilitiesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit ButtonGetCapabilitiesResponse(const MessageSharedPtr& message);
+ ButtonGetCapabilitiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ButtonGetCapabilitiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h
index 34722bc4f1..d7d4d18d97 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h
@@ -49,7 +49,8 @@ class ClosePopupRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit ClosePopupRequest(const MessageSharedPtr& message);
+ ClosePopupRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ClosePopupRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h
index ce3a6d2936..6dccad7b57 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h
@@ -49,7 +49,8 @@ class ClosePopupResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit ClosePopupResponse(const MessageSharedPtr& message);
+ ClosePopupResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ClosePopupResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h
index 7d59abdadd..2b002c31dd 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Ford Motor Company
+ * Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,23 +50,24 @@ class DialNumberRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit DialNumberRequest(const MessageSharedPtr& message);
+ DialNumberRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DialNumberRequest class destructor
**/
- ~DialNumberRequest() OVERRIDE;
+ virtual ~DialNumberRequest();
/**
* @brief Execute command
**/
- void Run() OVERRIDE;
+ virtual void Run();
private:
DISALLOW_COPY_AND_ASSIGN(DialNumberRequest);
};
-} // namespace hmi
+} // namespace hmi
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h
index 93a2e06c5f..1fbef15307 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Ford Motor Company
+ * Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,23 +51,24 @@ class DialNumberResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit DialNumberResponse(const MessageSharedPtr& message);
+ DialNumberResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DialNumberResponse class destructor
**/
- ~DialNumberResponse() OVERRIDE;
+ virtual ~DialNumberResponse();
/**
* @brief Execute command
**/
- void Run() OVERRIDE;
+ virtual void Run();
private:
DISALLOW_COPY_AND_ASSIGN(DialNumberResponse);
};
-} // namespace hmi
+} // namespace hmi
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h
index 8262dbb6fa..f4e421473c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief GetSystemInfoRequest command class
**/
class GetSystemInfoRequest : public RequestToHMI {
- public:
- /**
- * @brief GetSystemInfoRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit GetSystemInfoRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief GetSystemInfoRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetSystemInfoRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief GetSystemInfoRequest class destructor
- **/
- virtual ~GetSystemInfoRequest();
+ /**
+ * @brief GetSystemInfoRequest class destructor
+ **/
+ virtual ~GetSystemInfoRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h
index 70983d3ce3..766a2869d9 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h
@@ -34,35 +34,46 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_GET_SYSTEM_INFO_RESPONSE_H_
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
+struct SystemInfo {
+ std::string ccpu_version;
+ std::string wers_country_code;
+ std::string language;
+};
+
/**
* @brief GetSystemInfoResponse command class
**/
class GetSystemInfoResponse : public ResponseFromHMI {
- public:
- /**
- * @brief GetSystemInfoResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit GetSystemInfoResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief GetSystemInfoResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetSystemInfoResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief GetSystemInfoResponse class destructor
+ **/
+ virtual ~GetSystemInfoResponse();
- /**
- * @brief GetSystemInfoResponse class destructor
- **/
- virtual ~GetSystemInfoResponse();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ private:
+ const SystemInfo GetSystemInfo(
+ const hmi_apis::Common_Result::eType code) const;
- private:
- DISALLOW_COPY_AND_ASSIGN(GetSystemInfoResponse);
+ DISALLOW_COPY_AND_ASSIGN(GetSystemInfoResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h b/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h
index ac7cf80ac2..5f75f42d5c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h
@@ -38,51 +38,60 @@
namespace application_manager {
namespace commands {
-
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
/**
* @brief GetUrls command class
**/
class GetUrls : public RequestFromHMI {
- public:
- /**
- * @brief GetUrls class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit GetUrls(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief GetUrls class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetUrls(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief GetUrls class destructor
- **/
- virtual ~GetUrls();
+ /**
+ * @brief GetUrls class destructor
+ **/
+ virtual ~GetUrls();
- /**
- * @brief Execute command
- **/
- void Run() OVERRIDE;
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
- private:
+ private:
#ifdef EXTENDED_POLICY
- /**
- * @brief Processes URLs collecting for policy service
- * @param endpoints Endpoints section of policy table
- */
- void ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints);
+ /**
+ * @brief Processes URLs collecting for policy service
+ * @param endpoints Endpoints section of policy table
+ */
+ void ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints);
#endif
- /**
- * @brief Process URLs collecting for service
- * @param endpoints Endpoints section of policy table
- */
- void ProcessServiceURLs(const policy::EndpointUrls& endpoints);
+ /**
+ * @brief Process URLs collecting for service
+ * @param endpoints Endpoints section of policy table
+ */
+ void ProcessServiceURLs(const policy::EndpointUrls& endpoints);
+
+ /**
+ * @brief Sends response to HMI
+ * @param result Result code
+ */
+ void SendResponseToHMI(hmi_apis::Common_Result::eType result);
- /**
- * @brief Sends response to HMI
- * @param result Result code
- */
- void SendResponseToHMI(hmi_apis::Common_Result::eType result);
+ /**
+ * @brief fills structure for sending to HMI with default urls
+ * @param urls structure for filling
+ * @param endpoints Endpoints section of policy table
+ */
+ void FillSODefaultUrls(smart_objects::SmartObject& urls,
+ const policy::EndpointUrls& endpoints);
- DISALLOW_COPY_AND_ASSIGN(GetUrls);
+ DISALLOW_COPY_AND_ASSIGN(GetUrls);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h b/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h
index 956e5a788e..1ca9ba93db 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h
@@ -39,26 +39,27 @@ namespace application_manager {
namespace commands {
class GetUrlsResponse : public ResponseToHMI {
- public:
- /**
- * @brief GetUrlsResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit GetUrlsResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief GetUrlsResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetUrlsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief GetUrlsResponse class destructor
- **/
- virtual ~GetUrlsResponse();
+ /**
+ * @brief GetUrlsResponse class destructor
+ **/
+ virtual ~GetUrlsResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(GetUrlsResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetUrlsResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h
index 2957693c9e..4989208f7a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h
@@ -49,7 +49,8 @@ class MixingAudioSupportedRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit MixingAudioSupportedRequest(const MessageSharedPtr& message);
+ MixingAudioSupportedRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief MixingAudioSupportedRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h
index e2b5affe34..a0cf89f558 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h
@@ -49,7 +49,8 @@ class MixingAudioSupportedResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit MixingAudioSupportedResponse(const MessageSharedPtr& message);
+ MixingAudioSupportedResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief MixingAudioSupportedResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h
index 58f85f829a..123c0ab0d6 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h
@@ -49,7 +49,8 @@ class NaviAlertManeuverRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviAlertManeuverRequest(const MessageSharedPtr& message);
+ NaviAlertManeuverRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviAlertManeuverRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h
index 11f46d5da8..d4a57e9e2f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h
@@ -49,7 +49,8 @@ class NaviAlertManeuverResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviAlertManeuverResponse(const MessageSharedPtr& message);
+ NaviAlertManeuverResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviAlertManeuverResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h
index 3e95c6b16b..d6f4fd36e2 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h
@@ -50,19 +50,19 @@ class AudioStartStreamRequest : public RequestToHMI,
*
* @param message Incoming SmartObject message
**/
- explicit AudioStartStreamRequest(const MessageSharedPtr& message);
+ AudioStartStreamRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnNaviStartStreamRequest class destructor
**/
virtual ~AudioStartStreamRequest();
- /**
- * @brief onTimeOut from requrst Controller
- */
+ /**
+ * @brief onTimeOut from requrst Controller
+ */
virtual void onTimeOut();
-
/**
* @brief Execute command
**/
@@ -73,13 +73,13 @@ class AudioStartStreamRequest : public RequestToHMI,
**/
virtual void on_event(const event_engine::Event& event);
- /**
- * @brief RetryStartSession resend HMI startSession request if needed.
- * If limit expired, set audio_stream_retry_number counter to 0
- */
+ /**
+ * @brief RetryStartSession resend HMI startSession request if needed.
+ * If limit expired, set audio_stream_retry_number counter to 0
+ */
void RetryStartSession();
- private:
+ private:
uint32_t retry_number_;
DISALLOW_COPY_AND_ASSIGN(AudioStartStreamRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h
index 01992eb3b7..485b510bf2 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h
@@ -48,7 +48,8 @@ class AudioStartStreamResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AudioStartStreamResponse(const MessageSharedPtr& message);
+ AudioStartStreamResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AudioStartStreamResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h
index 04bba8b752..3a21e3e827 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h
@@ -48,7 +48,8 @@ class AudioStopStreamRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AudioStopStreamRequest(const MessageSharedPtr& message);
+ AudioStopStreamRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviStopStreamRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h
index 7275ac34d8..ce32d5b627 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h
@@ -48,7 +48,8 @@ class AudioStopStreamResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit AudioStopStreamResponse(const MessageSharedPtr& message);
+ AudioStopStreamResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnNaviStopStreamResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h
new file mode 100644
index 0000000000..33c5dfe2db
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h
@@ -0,0 +1,71 @@
+/*
+ * 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_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/hmi/request_to_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviGetWayPointsRequest command class
+ **/
+class NaviGetWayPointsRequest : public RequestToHMI {
+ public:
+ /**
+ * @brief NaviGetWayPointsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviGetWayPointsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+ /**
+ * @brief NaviGetWayPointsRequest class destructor
+ **/
+ virtual ~NaviGetWayPointsRequest();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviGetWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
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/navi_get_way_points_response.h
index ceba0528fa..633d927715 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/navi_get_way_points_response.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
@@ -30,43 +30,44 @@
* 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_NAVI_GET_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_
-#include "application_manager/commands/hmi/notification_to_hmi.h"
+#include "application_manager/commands/hmi/response_from_hmi.h"
namespace application_manager {
namespace commands {
/**
- * @brief OnPlayToneNotification command class
+ * @brief NaviGetWaypoints command class
**/
-class OnPlayToneNotification : public NotificationToHMI {
+class NaviGetWayPointsResponse : public ResponseFromHMI {
public:
/**
- * @brief OnPlayToneNotification class constructor
+ * @brief NaviGetWaypoints class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnPlayToneNotification(const MessageSharedPtr& message);
+ NaviGetWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
- * @brief OnPlayToneNotification class destructor
+ * @brief NaviGetWaypoints class destructor
**/
- virtual ~OnPlayToneNotification();
+ virtual ~NaviGetWayPointsResponse();
/**
* @brief Execute command
**/
- virtual void Run();
+ virtual void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnPlayToneNotification);
+ DISALLOW_COPY_AND_ASSIGN(NaviGetWayPointsResponse);
};
} // 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_NAVI_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
index e779ecb699..9f1adaeee0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
@@ -49,7 +49,8 @@ class NaviIsReadyRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviIsReadyRequest(const MessageSharedPtr& message);
+ NaviIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviIsReadyRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h
index 3da6933bc3..72c001b863 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h
@@ -49,7 +49,8 @@ class NaviIsReadyResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviIsReadyResponse(const MessageSharedPtr& message);
+ NaviIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviIsReadyResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h
index 45474b532a..56a9594c0b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h
@@ -49,7 +49,8 @@ class NaviSendLocationRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
*/
- explicit NaviSendLocationRequest(const MessageSharedPtr& message);
+ NaviSendLocationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviSendLocationRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h
index ef9a605c36..ec3392642a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h
@@ -49,7 +49,8 @@ class NaviSendLocationResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
*/
- explicit NaviSendLocationResponse(const MessageSharedPtr& message);
+ NaviSendLocationResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviSendLocationResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h
index b866ce3e1f..4cb8ddd7f7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h
@@ -49,7 +49,8 @@ class NaviShowConstantTBTRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviShowConstantTBTRequest(const MessageSharedPtr& message);
+ NaviShowConstantTBTRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviShowConstantTBTRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h
index 3f212985f9..d9e7b1d234 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h
@@ -49,7 +49,8 @@ class NaviShowConstantTBTResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviShowConstantTBTResponse(const MessageSharedPtr& message);
+ NaviShowConstantTBTResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviShowConstantTBTResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h
index 0e8cd39cc9..6fcb3f3267 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h
@@ -44,44 +44,44 @@ namespace commands {
**/
class NaviStartStreamRequest : public RequestToHMI,
public event_engine::EventObserver {
- public:
- /**
- * @brief NaviStartStreamRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit NaviStartStreamRequest(const MessageSharedPtr& message);
-
- /**
- * @brief OnNaviStartStreamRequest class destructor
- **/
- virtual ~NaviStartStreamRequest();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ public:
+ /**
+ * @brief NaviStartStreamRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviStartStreamRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief On event callback
- **/
- virtual void on_event(const event_engine::Event& event);
+ /**
+ * @brief OnNaviStartStreamRequest class destructor
+ **/
+ virtual ~NaviStartStreamRequest();
- /**
- * @brief onTimeOut from requrst Controller
- */
- virtual void onTimeOut();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+ /**
+ * @brief On event callback
+ **/
+ virtual void on_event(const event_engine::Event& event);
- /**
- * @brief RetryStartSession resend HMI startSession request if needed.
- * If limit expired, set video_stream_retry_number counter to 0
+ /**
+ * @brief onTimeOut from requrst Controller
*/
- void RetryStartSession();
+ virtual void onTimeOut();
+
+ /**
+ * @brief RetryStartSession resend HMI startSession request if needed.
+ * If limit expired, set video_stream_retry_number counter to 0
+ */
+ void RetryStartSession();
- private:
- uint32_t retry_number_;
- DISALLOW_COPY_AND_ASSIGN(NaviStartStreamRequest);
+ private:
+ uint32_t retry_number_;
+ DISALLOW_COPY_AND_ASSIGN(NaviStartStreamRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h
index c94b6f219c..3e18767194 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h
@@ -48,7 +48,8 @@ class NaviStartStreamResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviStartStreamResponse(const MessageSharedPtr& message);
+ NaviStartStreamResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviStartStreamResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h
index 86b0981c22..d6952d0305 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h
@@ -48,7 +48,8 @@ class NaviStopStreamRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviStopStreamRequest(const MessageSharedPtr& message);
+ NaviStopStreamRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviStopStreamRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h
index 6f4986e4c7..b3107b5e61 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h
@@ -48,7 +48,8 @@ class NaviStopStreamResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviStopStreamResponse(const MessageSharedPtr& message);
+ NaviStopStreamResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnNaviStopStreamResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h
new file mode 100644
index 0000000000..33a2077918
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h
@@ -0,0 +1,71 @@
+/*
+ * 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_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/hmi/request_to_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviSubscribeWayPointsRequest command class
+ **/
+class NaviSubscribeWayPointsRequest : public RequestToHMI {
+ public:
+ /**
+ * @brief NaviSubscribeWayPointsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviSubscribeWayPointsRequest(const MessageSharedPtr& messag,
+ ApplicationManager& application_manager);
+ /**
+ * @brief NaviSubscribeWayPointsRequest class destructor
+ **/
+ virtual ~NaviSubscribeWayPointsRequest();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h
new file mode 100644
index 0000000000..eff2b281f2
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h
@@ -0,0 +1,73 @@
+/*
+ * 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_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/hmi/response_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviSubscribeWaypoints command class
+ **/
+class NaviSubscribeWayPointsResponse : public ResponseFromHMI {
+ public:
+ /**
+ * @brief NaviSubscribeWaypoints class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviSubscribeWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief NaviSubscribeWaypoints class destructor
+ **/
+ virtual ~NaviSubscribeWayPointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsResponse);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h
new file mode 100644
index 0000000000..607bb1ef26
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h
@@ -0,0 +1,71 @@
+/*
+ * 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_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/hmi/request_to_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviSubscribeWayPointsRequest command class
+ **/
+class NaviUnSubscribeWayPointsRequest : public RequestToHMI {
+ public:
+ /**
+ * @brief NaviUnSubscribeWayPointsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviUnSubscribeWayPointsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+ /**
+ * @brief NaviUnSubscribeWayPointsRequest class destructor
+ **/
+ virtual ~NaviUnSubscribeWayPointsRequest();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviUnSubscribeWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h
new file mode 100644
index 0000000000..936814f2fe
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h
@@ -0,0 +1,72 @@
+/*
+ * 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_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/hmi/response_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviUnSubscribeWaypoints command class
+ **/
+class NaviUnsubscribeWayPointsResponse : public ResponseFromHMI {
+ public:
+ /**
+ * @brief NaviUnSubscribeWaypoints class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ NaviUnsubscribeWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief NaviUnSubscribeWaypoints class destructor
+ **/
+ virtual ~NaviUnsubscribeWayPointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviUnsubscribeWayPointsResponse);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h
index a5e2f8bf37..830e9358ec 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h
@@ -49,7 +49,8 @@ class NaviUpdateTurnListRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviUpdateTurnListRequest(const MessageSharedPtr& message);
+ NaviUpdateTurnListRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviUpdateTurnListRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h
index 0e15a9175c..93c714b4f4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h
@@ -49,7 +49,8 @@ class NaviUpdateTurnListResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit NaviUpdateTurnListResponse(const MessageSharedPtr& message);
+ NaviUpdateTurnListResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief NaviUpdateTurnListResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h
index 1dcae4366d..c74108ccf0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h
@@ -50,14 +50,16 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
class NotificationFromHMI : public CommandImpl {
public:
- explicit NotificationFromHMI(const MessageSharedPtr& message);
+ NotificationFromHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~NotificationFromHMI();
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
void SendNotificationToMobile(const MessageSharedPtr& message);
void CreateHMIRequest(const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject& msg_params) const;
+ const smart_objects::SmartObject& msg_params) const;
+
private:
DISALLOW_COPY_AND_ASSIGN(NotificationFromHMI);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h
index 2372754b63..dd2db8804a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h
@@ -41,12 +41,14 @@ namespace commands {
class NotificationToHMI : public CommandImpl {
public:
- explicit NotificationToHMI(const MessageSharedPtr& message);
+ NotificationToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~NotificationToHMI();
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
void SendNotification();
+
private:
DISALLOW_COPY_AND_ASSIGN(NotificationToHMI);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h
index 6ec14e35b0..ee7d22b859 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnAllowSDLFunctionalityNotification command class
**/
class OnAllowSDLFunctionalityNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnAllowSDLFunctionalityNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnAllowSDLFunctionalityNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnAllowSDLFunctionalityNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAllowSDLFunctionalityNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnAllowSDLFunctionalityNotification class destructor
- **/
- virtual ~OnAllowSDLFunctionalityNotification();
+ /**
+ * @brief OnAllowSDLFunctionalityNotification class destructor
+ **/
+ virtual ~OnAllowSDLFunctionalityNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnAllowSDLFunctionalityNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAllowSDLFunctionalityNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h
index 011df3832c..a1de12b4d6 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnAppActivatedNotification command class
**/
class OnAppActivatedNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnAppActivatedNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnAppActivatedNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnAppActivatedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppActivatedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnAppActivatedNotification class destructor
- **/
- virtual ~OnAppActivatedNotification();
+ /**
+ * @brief OnAppActivatedNotification class destructor
+ **/
+ virtual ~OnAppActivatedNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnAppActivatedNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppActivatedNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h
index 8731fc43f1..687d492a01 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h
@@ -49,7 +49,8 @@ class OnAppDeactivatedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnAppDeactivatedNotification(const MessageSharedPtr& message);
+ OnAppDeactivatedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnAppDeactivatedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h
index c6ea82a15c..bdaf6d1119 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnAppPermissionChangedNotification command class
**/
class OnAppPermissionChangedNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnAppPermissionChangedNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnAppPermissionChangedNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnAppPermissionChangedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppPermissionChangedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnAppPermissionChangedNotification class destructor
- **/
- virtual ~OnAppPermissionChangedNotification();
+ /**
+ * @brief OnAppPermissionChangedNotification class destructor
+ **/
+ virtual ~OnAppPermissionChangedNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnAppPermissionChangedNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppPermissionChangedNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h
index ea36d55b39..5cafe0c1b5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnAppPermissionConsentNotification command class
**/
class OnAppPermissionConsentNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnAppPermissionConsentNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnAppPermissionConsentNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnAppPermissionConsentNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppPermissionConsentNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnAppPermissionConsentNotification class destructor
- **/
- virtual ~OnAppPermissionConsentNotification();
+ /**
+ * @brief OnAppPermissionConsentNotification class destructor
+ **/
+ virtual ~OnAppPermissionConsentNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnAppPermissionConsentNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppPermissionConsentNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h
index 1ebbfcd483..58e92a977a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h
@@ -49,7 +49,8 @@ class OnAppRegisteredNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnAppRegisteredNotification(const MessageSharedPtr& message);
+ OnAppRegisteredNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnAppRegisteredNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h
index 96fd19e9bc..980e558d6f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h
@@ -49,7 +49,8 @@ class OnAppUnregisteredNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnAppUnregisteredNotification(const MessageSharedPtr& message);
+ OnAppUnregisteredNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnAppUnregisteredNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h
index 97a979065e..121367ed90 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnAudioDataStreamingNotification command class
**/
class OnAudioDataStreamingNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnAudioDataStreamingNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnAudioDataStreamingNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnAudioDataStreamingNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAudioDataStreamingNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnAudioDataStreamingNotification class destructor
- **/
- virtual ~OnAudioDataStreamingNotification();
+ /**
+ * @brief OnAudioDataStreamingNotification class destructor
+ **/
+ virtual ~OnAudioDataStreamingNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnAudioDataStreamingNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAudioDataStreamingNotification);
};
} // namespace commands
@@ -70,4 +71,3 @@ class OnAudioDataStreamingNotification : public NotificationToHMI {
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_AUDIO_DATA_STREAMING_NOTIFICATION_H_
-
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h
index 0a56d7d924..f294bce2c8 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h
@@ -53,7 +53,8 @@ class OnButtonEventNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnButtonEventNotification(const MessageSharedPtr& message);
+ OnButtonEventNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief Execute command
@@ -64,7 +65,7 @@ class OnButtonEventNotification : public NotificationFromHMI {
DISALLOW_COPY_AND_ASSIGN(OnButtonEventNotification);
};
-} // namespace hmi
+} // namespace hmi
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h
index ce5f1de8f1..8936ed8a0f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h
@@ -53,7 +53,8 @@ class OnButtonPressNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnButtonPressNotification(const MessageSharedPtr& message);
+ OnButtonPressNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h
index c046380cd7..d98ba3a90b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h
@@ -51,7 +51,8 @@ class OnButtonSubscriptionNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnButtonSubscriptionNotification(const MessageSharedPtr& message);
+ OnButtonSubscriptionNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnButtonSubscriptionNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h
index 17ba26b7f7..5345135583 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h
@@ -49,7 +49,8 @@ class OnDeviceChosenNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnDeviceChosenNotification(const MessageSharedPtr& message);
+ OnDeviceChosenNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnDeviceChosenNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h
index b87a6e2d9f..62a87f4599 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnDeviceStateChangedNotification command class
**/
class OnDeviceStateChangedNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnDeviceStateChangedNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnDeviceStateChangedNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnDeviceStateChangedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnDeviceStateChangedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnDeviceStateChangedNotification class destructor
- **/
- virtual ~OnDeviceStateChangedNotification();
+ /**
+ * @brief OnDeviceStateChangedNotification class destructor
+ **/
+ virtual ~OnDeviceStateChangedNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnDeviceStateChangedNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnDeviceStateChangedNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h
index 01a87aae05..69d1707bf7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h
@@ -53,7 +53,8 @@ class OnDriverDistractionNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnDriverDistractionNotification(const MessageSharedPtr& message);
+ OnDriverDistractionNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnDriverDistractionNotification class destructor
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/on_event_changed_notification.h
index 45d831eb03..e066332d4c 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/on_event_changed_notification.h
@@ -30,8 +30,8 @@
* 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_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"
@@ -39,25 +39,23 @@ namespace application_manager {
namespace commands {
-namespace hmi {
-
-
/**
- * @brief OnPhoneCallNotification command class
+ * @brief OnEventChangedNotification command class
**/
-class OnPhoneCallNotification : public NotificationFromHMI {
+class OnEventChangedNotification : public NotificationFromHMI {
public:
/**
- * @brief OnPhoneCallNotification class constructor
+ * @brief OnEventChangedNotification class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnPhoneCallNotification(const MessageSharedPtr& message);
+ OnEventChangedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
- * @brief OnPhoneCallNotification class destructor
+ * @brief OnEventChangedNotification class destructor
**/
- virtual ~OnPhoneCallNotification();
+ virtual ~OnEventChangedNotification();
/**
* @brief Execute command
@@ -65,13 +63,11 @@ class OnPhoneCallNotification : public NotificationFromHMI {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification);
+ DISALLOW_COPY_AND_ASSIGN(OnEventChangedNotification);
};
-} // 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_ON_EVENT_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
index 65d78f60c6..ad10a58bff 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
@@ -49,7 +49,8 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnExitAllApplicationsNotification(const MessageSharedPtr& message);
+ OnExitAllApplicationsNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnExitAllApplicationsNotification class destructor
@@ -62,7 +63,6 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI {
virtual void Run();
private:
-
/**
* @brief Notify's HMI that SDL stored all data required for resumption
**/
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h
index 479dd3a09c..275b266b98 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h
@@ -49,7 +49,8 @@ class OnExitApplicationNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnExitApplicationNotification(const MessageSharedPtr& message);
+ OnExitApplicationNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnExitApplicationNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h
index cc47705c82..3f1ac17fc4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h
@@ -49,7 +49,8 @@ class OnFileRemovedNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnFileRemovedNotification(const MessageSharedPtr& message);
+ OnFileRemovedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnFileRemovedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h b/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h
index f9fb9cdb21..32db73c2f5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h
@@ -49,7 +49,8 @@ class OnFindApplications : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnFindApplications(const MessageSharedPtr& message);
+ OnFindApplications(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnFindApplications class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h
index f8fccdc382..acb1ff31ac 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h
@@ -50,7 +50,8 @@ class OnIgnitionCycleOverNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnIgnitionCycleOverNotification(const MessageSharedPtr& message);
+ OnIgnitionCycleOverNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnIgnitionCycleOverNotification class destructor
@@ -63,7 +64,6 @@ class OnIgnitionCycleOverNotification : public NotificationFromHMI {
virtual void Run();
private:
-
DISALLOW_COPY_AND_ASSIGN(OnIgnitionCycleOverNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h
index a657ffcc68..0150853546 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_TBT_CLIENT_STATE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnNaviTBTClientStateNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnNaviTBTClientStateNotification(const MessageSharedPtr& message);
+ OnNaviTBTClientStateNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnNaviTBTClientStateNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h
new file mode 100644
index 0000000000..d304685008
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h
@@ -0,0 +1,73 @@
+/*
+ * 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_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
+
+#include "application_manager/commands/hmi/notification_from_hmi.h"
+#include "application_manager/application_manager.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief OnNaviWayPointChangeNotification command class
+ **/
+class OnNaviWayPointChangeNotification : public NotificationFromHMI {
+ public:
+ /**
+ * @brief OnNaviWayPointChangeNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnNaviWayPointChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& app_man);
+
+ /**
+ * @brief OnNaviWayPointChangeNotification class destructor
+ **/
+ virtual ~OnNaviWayPointChangeNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnNaviWayPointChangeNotification);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h
index 81278fb75a..d4380048ee 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h
@@ -39,26 +39,27 @@ namespace application_manager {
namespace commands {
class OnPolicyUpdate : public NotificationFromHMI {
- public:
- /**
- * @brief OnPolicyUpdate class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnPolicyUpdate(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnPolicyUpdate class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnPolicyUpdate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnPolicyUpdate class destructor
- **/
- virtual ~OnPolicyUpdate();
+ /**
+ * @brief OnPolicyUpdate class destructor
+ **/
+ virtual ~OnPolicyUpdate();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnPolicyUpdate);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnPolicyUpdate);
};
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h
index bc60284309..809623fda0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h
@@ -50,7 +50,8 @@ class OnPutFileNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnPutFileNotification(const MessageSharedPtr& message);
+ OnPutFileNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnPutFileNotification class destructor
@@ -63,7 +64,6 @@ class OnPutFileNotification : public NotificationToHMI {
virtual void Run();
private:
-
DISALLOW_COPY_AND_ASSIGN(OnPutFileNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h
index 24fc52deac..7df1bf5ac0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_READY_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnReadyNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnReadyNotification(const MessageSharedPtr& message);
+ OnReadyNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnReadyNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
index 4b61deef4f..4c2eacdae3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
@@ -46,7 +46,8 @@ class OnReceivedPolicyUpdate : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnReceivedPolicyUpdate(const MessageSharedPtr& message);
+ OnReceivedPolicyUpdate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnReceivedPolicyUpdate class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h
index 67cccdd816..fbb8a0522a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h
@@ -49,7 +49,8 @@ class OnRecordStartdNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnRecordStartdNotification(const MessageSharedPtr& message);
+ OnRecordStartdNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnRecordStartdNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h
index 03f84d0907..764ee6d180 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h
@@ -50,7 +50,8 @@ class OnResumeAudioSourceNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnResumeAudioSourceNotification(const MessageSharedPtr& message);
+ OnResumeAudioSourceNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnResumeAudioSourceNotification class destructor
@@ -63,7 +64,6 @@ class OnResumeAudioSourceNotification : public NotificationToHMI {
virtual void Run();
private:
-
DISALLOW_COPY_AND_ASSIGN(OnResumeAudioSourceNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h
index 5b9ac04e8f..ef1d289ca7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h
@@ -49,7 +49,8 @@ class OnSDLCloseNotification : public NotificationToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnSDLCloseNotification(const MessageSharedPtr& message);
+ OnSDLCloseNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnSdlCloseNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h
index 4f30873e4e..e54daab96f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnSDLConsentNeededNotification command class
**/
class OnSDLConsentNeededNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnSDLConsentNeededNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnSDLConsentNeededNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnSDLConsentNeededNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnSDLConsentNeededNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnSDLConsentNeededNotification class destructor
- **/
- virtual ~OnSDLConsentNeededNotification();
+ /**
+ * @brief OnSDLConsentNeededNotification class destructor
+ **/
+ virtual ~OnSDLConsentNeededNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnSDLConsentNeededNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnSDLConsentNeededNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h
index 6f8f3a6e1a..6ac04b488b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnSDLPersistenceCompleteNotification command class
**/
class OnSDLPersistenceCompleteNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnSDLPersistenceCompleteNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnSDLPersistenceCompleteNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnSDLPersistenceCompleteNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnSDLPersistenceCompleteNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnSDLPersistenceCompleteNotification class destructor
- **/
- virtual ~OnSDLPersistenceCompleteNotification();
+ /**
+ * @brief OnSDLPersistenceCompleteNotification class destructor
+ **/
+ virtual ~OnSDLPersistenceCompleteNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnSDLPersistenceCompleteNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnSDLPersistenceCompleteNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h b/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h
index bfa14f67fc..dc40c1a614 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h
@@ -49,7 +49,8 @@ class OnStartDeviceDiscovery : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnStartDeviceDiscovery(const MessageSharedPtr& message);
+ OnStartDeviceDiscovery(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnStartDeviceDiscovery class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h
index c123826886..62ee38c473 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnGetStatusUpdateNotification command class
**/
class OnStatusUpdateNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnGetStatusUpdateNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnStatusUpdateNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnGetStatusUpdateNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnStatusUpdateNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnGetStatusUpdateNotification class destructor
- **/
- virtual ~OnStatusUpdateNotification();
+ /**
+ * @brief OnGetStatusUpdateNotification class destructor
+ **/
+ virtual ~OnStatusUpdateNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnStatusUpdateNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnStatusUpdateNotification);
};
} // namespace commands
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..9008a20cc9 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
@@ -51,7 +51,8 @@ class OnSystemContextNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnSystemContextNotification(const MessageSharedPtr& message);
+ OnSystemContextNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnSystemContextNotification class destructor
@@ -64,9 +65,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/on_system_error_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h
index ee7df7acd6..1e65b15c20 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h
@@ -49,7 +49,8 @@ class OnSystemErrorNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnSystemErrorNotification(const MessageSharedPtr& message);
+ OnSystemErrorNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnSystemErrorNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h
index 9b6c62782c..d709a5267c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnSystemInfoChangedNotification command class
**/
class OnSystemInfoChangedNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnSystemInfoChangedNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnSystemInfoChangedNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnSystemInfoChangedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnSystemInfoChangedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnSystemInfoChangedNotification class destructor
- **/
- virtual ~OnSystemInfoChangedNotification();
+ /**
+ * @brief OnSystemInfoChangedNotification class destructor
+ **/
+ virtual ~OnSystemInfoChangedNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnSystemInfoChangedNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnSystemInfoChangedNotification);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h
index f1d25e24a4..8e4db24822 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h
@@ -50,7 +50,8 @@ class OnSystemRequestNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnSystemRequestNotification(const MessageSharedPtr& message);
+ OnSystemRequestNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnSystemRequestNotification class destructor
@@ -63,7 +64,6 @@ class OnSystemRequestNotification : public NotificationFromHMI {
virtual void Run();
private:
-
DISALLOW_COPY_AND_ASSIGN(OnSystemRequestNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h
index 79ae9b496e..245dc32386 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h
@@ -49,7 +49,8 @@ class OnTTSLanguageChangeNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnTTSLanguageChangeNotification(const MessageSharedPtr& message);
+ OnTTSLanguageChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTTSLanguageChangeNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h
index 11cb755544..be84a93215 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h
@@ -51,7 +51,8 @@ class OnTTSResetTimeoutNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnTTSResetTimeoutNotification(const MessageSharedPtr& message);
+ OnTTSResetTimeoutNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTTSResetTimeoutNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h
index c7e88ac558..234d8036eb 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h
@@ -49,7 +49,8 @@ class OnTTSStartedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnTTSStartedNotification(const MessageSharedPtr& message);
+ OnTTSStartedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTTSStartedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h
index bf5dc7fb9e..4e058fde64 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h
@@ -49,7 +49,8 @@ class OnTTSStoppedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject OnTTSStartedNotificationmessage
**/
- explicit OnTTSStoppedNotification(const MessageSharedPtr& message);
+ OnTTSStoppedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTTSStoppedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h
index b4a0228c78..618bc13017 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h
@@ -49,7 +49,8 @@ class OnUICommandNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUICommandNotification(const MessageSharedPtr& message);
+ OnUICommandNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUICommandNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h
index 77b771065b..6e881dc94a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_UI_KEYBOARD_INPUT_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -52,7 +52,8 @@ class OnUIKeyBoardInputNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUIKeyBoardInputNotification(const MessageSharedPtr& message);
+ OnUIKeyBoardInputNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUIKeyBoardInputNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h
index bcb661c89d..cc8cd1eb0e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h
@@ -49,7 +49,8 @@ class OnUILanguageChangeNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUILanguageChangeNotification(const MessageSharedPtr& message);
+ OnUILanguageChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUILanguageChangeNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h
index f97c8768b5..f5dd173998 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h
@@ -51,7 +51,8 @@ class OnUIResetTimeoutNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUIResetTimeoutNotification(const MessageSharedPtr& message);
+ OnUIResetTimeoutNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUIResetTimeoutNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h
index 6d8005e12f..9e9384fffe 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_UI_TOUCH_EVENT_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -52,7 +52,8 @@ class OnUITouchEventNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUITouchEventNotification(const MessageSharedPtr& message);
+ OnUITouchEventNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUITouchEventNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h b/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h
index f56d01a5cc..ee53445606 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h
@@ -49,7 +49,8 @@ class OnUpdateDeviceList : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnUpdateDeviceList(const MessageSharedPtr& message);
+ OnUpdateDeviceList(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnUpdateDeviceList class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h
index d591ab2be6..9c5a8cd955 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIAccPedalPositionNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIAccPedalPositionNotification(const MessageSharedPtr& message);
+ OnVIAccPedalPositionNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIAccPedalPositionNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h
index f901462fdf..c4f92269bb 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIBeltStatusNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIBeltStatusNotification(const MessageSharedPtr& message);
+ OnVIBeltStatusNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIBeltStatusNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h
index a0bc31778a..9d9854c50b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIBodyInformationNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIBodyInformationNotification(const MessageSharedPtr& message);
+ OnVIBodyInformationNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIBodyInformationNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h
index 0e24616f3e..c31ee1f209 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIDeviceStatusNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIDeviceStatusNotification(const MessageSharedPtr& message);
+ OnVIDeviceStatusNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIDeviceStatusNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h
index 0290388756..108f02b5a4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIDriverBrakingNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIDriverBrakingNotification(const MessageSharedPtr& message);
+ OnVIDriverBrakingNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIDriverBrakingNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h
index 8307e5359e..bbd13963aa 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIEngineTorqueNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIEngineTorqueNotification(const MessageSharedPtr& message);
+ OnVIEngineTorqueNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIEngineTorqueNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h
index be5b086853..b996febacf 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIExternalTemperatureNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIExternalTemperatureNotification(const MessageSharedPtr& message);
+ OnVIExternalTemperatureNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIExternalTemperatureNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h
index 83e6f845e0..9c30b6c32c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIFuelLevelNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIFuelLevelNotification(const MessageSharedPtr& message);
+ OnVIFuelLevelNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIFuelLevelNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h
index 42a6b8e0d9..53b6ea209f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIFuelLevelStateNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIFuelLevelStateNotification(const MessageSharedPtr& message);
+ OnVIFuelLevelStateNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIFuelLevelStateNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h
index 01c2cf60b6..579344b538 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIGpsDataNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIGpsDataNotification(const MessageSharedPtr& message);
+ OnVIGpsDataNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIGpsDataNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h
index dc80b33ddd..5fd3be85a4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIHeadLampStatusNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIHeadLampStatusNotification(const MessageSharedPtr& message);
+ OnVIHeadLampStatusNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIHeadLampStatusNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h
index c4e5accead..ee82b1397f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIInstantFuelConsumptionNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIInstantFuelConsumptionNotification(const MessageSharedPtr& message);
+ OnVIInstantFuelConsumptionNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager);
/**
* @brief OnVIInstantFuelConsumptionNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h
index e2d9d91ae1..364e42081c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIMyKeyNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIMyKeyNotification(const MessageSharedPtr& message);
+ OnVIMyKeyNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIMyKeyNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h
index 7c1c691ac5..7d93530f04 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIOdometerNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIOdometerNotification(const MessageSharedPtr& message);
+ OnVIOdometerNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIOdometerNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h
index bf2ca83f8f..c09220d2a6 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIPrndlNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIPrndlNotification(const MessageSharedPtr& message);
+ OnVIPrndlNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIPrndlNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h
index ebcfe3a86c..d05e1221df 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIRpmNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIRpmNotification(const MessageSharedPtr& message);
+ OnVIRpmNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIRpmNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h
index 37bf66e4d0..b1908cde28 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVISpeedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVISpeedNotification(const MessageSharedPtr& message);
+ OnVISpeedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVISpeedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h
index bf01b2bf76..28f78ac4d5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVISteeringWheelAngleNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVISteeringWheelAngleNotification(const MessageSharedPtr& message);
+ OnVISteeringWheelAngleNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVISteeringWheelAngleNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h
index 1c1e00d893..eef4f0e4a4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVITirePressureNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVITirePressureNotification(const MessageSharedPtr& message);
+ OnVITirePressureNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVITirePressureNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h
index 59da271a04..2422c47813 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_VEHICLE_DATA_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -51,7 +51,8 @@ class OnVIVehicleDataNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIVehicleDataNotification(const MessageSharedPtr& message);
+ OnVIVehicleDataNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIVehicleDataNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h
index 06b73c508d..4ea04fbb0d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIVinNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIVinNotification(const MessageSharedPtr& message);
+ OnVIVinNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIVinNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h
index 399b38112e..2b57ef1dd3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -50,7 +50,8 @@ class OnVIWiperStatusNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVIWiperStatusNotification(const MessageSharedPtr& message);
+ OnVIWiperStatusNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVIWiperStatusNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h
index 38749ba8f8..02c65df4e9 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief OnVideoDataStreamingNotification command class
**/
class OnVideoDataStreamingNotification : public NotificationToHMI {
- public:
- /**
- * @brief OnVideoDataStreamingNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnVideoDataStreamingNotification(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief OnVideoDataStreamingNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnVideoDataStreamingNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnVideoDataStreamingNotification class destructor
- **/
- virtual ~OnVideoDataStreamingNotification();
+ /**
+ * @brief OnVideoDataStreamingNotification class destructor
+ **/
+ virtual ~OnVideoDataStreamingNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVideoDataStreamingNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnVideoDataStreamingNotification);
};
} // namespace commands
@@ -70,4 +71,3 @@ class OnVideoDataStreamingNotification : public NotificationToHMI {
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VIDEO_DATA_STREAMING_NOTIFICATION_H_
-
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h
index 37bc2556f8..fa85ba8468 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h
@@ -50,7 +50,8 @@ class OnVRCommandNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVRCommandNotification(const MessageSharedPtr& message);
+ OnVRCommandNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVRCommandNotification class destructor
@@ -63,7 +64,6 @@ class OnVRCommandNotification : public NotificationFromHMI {
virtual void Run();
private:
-
DISALLOW_COPY_AND_ASSIGN(OnVRCommandNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h
index be408f0aa0..d0f86e5f83 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h
@@ -49,7 +49,8 @@ class OnVRLanguageChangeNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVRLanguageChangeNotification(const MessageSharedPtr& message);
+ OnVRLanguageChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVRLanguageChangeNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h
index 5ae5ace27b..f142fcc25c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h
@@ -49,7 +49,8 @@ class OnVRStartedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVRStartedNotification(const MessageSharedPtr& message);
+ OnVRStartedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVRStartedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h
index 311ee8acde..d1dbcc91cd 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h
@@ -49,7 +49,8 @@ class OnVRStoppedNotification : public NotificationFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit OnVRStoppedNotification(const MessageSharedPtr& message);
+ OnVRStoppedNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVRStoppedNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
index 9cb5a9f99d..c435c41c47 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
@@ -1,75 +1,82 @@
- /*
- 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.
+/*
+ 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_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
+
+#include "application_manager/commands/command_impl.h"
+#include "interfaces/HMI_API.h"
+
+namespace NsSmartDeviceLink {
+namespace NsSmartObjects {
+class SmartObject;
+}
+}
+
+namespace application_manager {
+
+namespace commands {
+
+namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
+
+class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
+ public:
+ RequestFromHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+ virtual ~RequestFromHMI();
+ virtual bool Init();
+ virtual bool CleanUp();
+ virtual void Run();
+ virtual void on_event(const event_engine::Event& event);
+ /**
+ * @brief SendResponse allows to send response to hmi
+ * @param correlation_id the correlation id for the rfesponse.
+ * @param function_id the function id for which response will be sent
+ * @param result_code the result code.
*/
+ void SendResponse(const bool success,
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code);
+
+ void FillCommonParametersOfSO(smart_objects::SmartObject* message,
+ uint32_t correlation_id,
+ hmi_apis::FunctionID::eType function_id);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RequestFromHMI);
+};
+
+} // namespace commands
+} // namespace application_manager
- #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
- #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
-
- #include "application_manager/commands/command_impl.h"
- #include "interfaces/HMI_API.h"
-
- namespace NsSmartDeviceLink {
- namespace NsSmartObjects {
- class SmartObject;
- }
- }
-
- namespace application_manager {
-
- namespace commands {
-
- namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
-
- class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
- public:
- explicit RequestFromHMI(const MessageSharedPtr& message);
- virtual ~RequestFromHMI();
- virtual bool Init();
- virtual bool CleanUp();
- virtual void Run();
- virtual void on_event(const event_engine::Event& event);
- /**
- * @brief SendResponse allows to send response to hmi
- * @param correlation_id the correlation id for the rfesponse.
- * @param function_id the function id for which response will be sent
- * @param result_code the result code.
- */
- void SendResponse(uint32_t correlation_id,
- hmi_apis::FunctionID::eType function_id,
- hmi_apis::Common_Result::eType result_code);
- private:
- DISALLOW_COPY_AND_ASSIGN(RequestFromHMI);
- };
-
- } // namespace commands
- } // namespace application_manager
-
- #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
index fe359182dd..e512279e79 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
@@ -34,15 +34,16 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_TO_HMI_H_
#include "application_manager/commands/command_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-
class RequestToHMI : public CommandImpl {
public:
- explicit RequestToHMI(const MessageSharedPtr& message);
+ RequestToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~RequestToHMI();
virtual bool Init();
virtual bool CleanUp();
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h
index 7769caa0a7..a5d41252f5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RESPONSE_FROM_HMI_H_
#include "application_manager/commands/command_impl.h"
+#include "application_manager/application_manager.h"
#include "interfaces/HMI_API.h"
namespace NsSmartDeviceLink {
@@ -50,12 +51,14 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
class ResponseFromHMI : public CommandImpl {
public:
- explicit ResponseFromHMI(const MessageSharedPtr& message);
+ ResponseFromHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~ResponseFromHMI();
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
- void SendResponseToMobile(const MessageSharedPtr& message);
+ void SendResponseToMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/*
* @brief Creates HMI request
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h
index ce9e9469d0..f00e57ff3a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h
@@ -51,7 +51,8 @@ namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
class ResponseToHMI : public CommandImpl {
public:
- explicit ResponseToHMI(const MessageSharedPtr& message);
+ ResponseToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
virtual ~ResponseToHMI();
virtual bool Init();
virtual bool CleanUp();
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h
index 58a7e9ecda..0dff904955 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h
@@ -34,54 +34,74 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_SDL_ACTIVATE_APP_REQUEST_H_
#include "application_manager/commands/hmi/request_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
- typedef std::pair<ApplicationSharedPtr, std::vector<ApplicationSharedPtr> > DevicesApps;
/**
* @brief SDLActivateAppRequest command class
**/
class SDLActivateAppRequest : public RequestFromHMI {
- public:
- /**
- * @brief SDLActivateAppRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLActivateAppRequest(const MessageSharedPtr& message);
-
- /**
- * @brief SDLActivateAppRequest class destructor
- **/
- virtual ~SDLActivateAppRequest();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- /**
- * @brief onTimeOut allows to process case when timeout has appeared
- * during request execution.
- */
- virtual void onTimeOut();
-
- /**
- * @brief on_event allows to handle events
- *
- * @param event event type that current request subscribed on.
- */
- virtual void on_event(const event_engine::Event& event);
- private:
- uint32_t app_id() const;
- uint32_t hmi_app_id(const smart_objects::SmartObject& so) const;
-
- DevicesApps FindAllAppOnParticularDevice(
- const connection_handler::DeviceHandle handle);
- DISALLOW_COPY_AND_ASSIGN(SDLActivateAppRequest);
+ public:
+ /**
+ * @brief Applications registered over protocol v4
+ */
+ typedef std::vector<application_manager::ApplicationSharedPtr> V4ProtoApps;
+
+ /**
+ * @brief SDLActivateAppRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLActivateAppRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief SDLActivateAppRequest class destructor
+ **/
+ ~SDLActivateAppRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief onTimeOut allows to process case when timeout has appeared
+ * during request execution.
+ */
+ void onTimeOut() OVERRIDE;
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const event_engine::Event& event) OVERRIDE;
+
+ private:
+ uint32_t app_id() const;
+ uint32_t hmi_app_id(const smart_objects::SmartObject& so) const;
+
+ /**
+ * @brief Retrieves all v4 protocol applications for particular device
+ * @param handle Device handle
+ * @return List of applications registered over v4 protocol
+ */
+ V4ProtoApps get_v4_proto_apps(
+ const connection_handler::DeviceHandle handle) const;
+
+ /**
+ * @brief Get v4 protocol application reported as forgrounded on device
+ * @param handle Device
+ * @return Pointer to application or empty pointer
+ */
+ ApplicationSharedPtr get_foreground_app(
+ const connection_handler::DeviceHandle handle) const;
+
+ DISALLOW_COPY_AND_ASSIGN(SDLActivateAppRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h
index bf0789e60e..f35a295581 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLActivateAppResponse command class
**/
class SDLActivateAppResponse : public ResponseToHMI {
- public:
- /**
- * @brief SDLActivateAppResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLActivateAppResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLActivateAppResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLActivateAppResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLActivateAppResponse class destructor
- **/
- virtual ~SDLActivateAppResponse();
+ /**
+ * @brief SDLActivateAppResponse class destructor
+ **/
+ virtual ~SDLActivateAppResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLActivateAppResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLActivateAppResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h
index 7c8f10529b..4f8d598322 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLGetListOfPermissionsRequest command class
**/
class SDLGetListOfPermissionsRequest : public RequestFromHMI {
- public:
- /**
- * @brief SDLGetListOfPermissionsRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetListOfPermissionsRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetListOfPermissionsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetListOfPermissionsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetListOfPermissionsRequest class destructor
- **/
- virtual ~SDLGetListOfPermissionsRequest();
+ /**
+ * @brief SDLGetListOfPermissionsRequest class destructor
+ **/
+ virtual ~SDLGetListOfPermissionsRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h
index 452784d92c..e00e613e70 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLGetListOfPermissionsResponse command class
**/
class SDLGetListOfPermissionsResponse : public ResponseToHMI {
- public:
- /**
- * @brief SDLGetListOfPermissionsResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetListOfPermissionsResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetListOfPermissionsResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetListOfPermissionsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetListOfPermissionsResponse class destructor
- **/
- virtual ~SDLGetListOfPermissionsResponse();
+ /**
+ * @brief SDLGetListOfPermissionsResponse class destructor
+ **/
+ virtual ~SDLGetListOfPermissionsResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h
index cb7d37d336..cfc0d55b54 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLGetStatusUpdateRequest command class
**/
class SDLGetStatusUpdateRequest : public RequestFromHMI {
- public:
- /**
- * @brief SDLGetStatusUpdateRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetStatusUpdateRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetStatusUpdateRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetStatusUpdateRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetStatusUpdateRequest class destructor
- **/
- virtual ~SDLGetStatusUpdateRequest();
+ /**
+ * @brief SDLGetStatusUpdateRequest class destructor
+ **/
+ virtual ~SDLGetStatusUpdateRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h
index a3fc0862b5..c25008bd90 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLGetStatusUpdateResponse command class
**/
class SDLGetStatusUpdateResponse : public ResponseToHMI {
- public:
- /**
- * @brief SDLGetStatusUpdateResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetStatusUpdateResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetStatusUpdateResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetStatusUpdateResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetStatusUpdateResponse class destructor
- **/
- virtual ~SDLGetStatusUpdateResponse();
+ /**
+ * @brief SDLGetStatusUpdateResponse class destructor
+ **/
+ virtual ~SDLGetStatusUpdateResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h
index 96f46cfa3d..7d9fec337c 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_GET_USER_FRIENDLY_MESSAGE_REQUEST_H_
#include "application_manager/commands/hmi/request_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -43,26 +44,27 @@ namespace commands {
* @brief SDLGetUserFriendlyMessageRequest command class
**/
class SDLGetUserFriendlyMessageRequest : public RequestFromHMI {
- public:
- /**
- * @brief SDLGetUserFriendlyMessageRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetUserFriendlyMessageRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetUserFriendlyMessageRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetUserFriendlyMessageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetUserFriendlyMessageRequest class destructor
- **/
- virtual ~SDLGetUserFriendlyMessageRequest();
+ /**
+ * @brief SDLGetUserFriendlyMessageRequest class destructor
+ **/
+ virtual ~SDLGetUserFriendlyMessageRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h
index 4cf7be56c9..43c440c277 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief SDLGetUserFriendlyMessageResponse command class
**/
class SDLGetUserFriendlyMessageResponse : public ResponseToHMI {
- public:
- /**
- * @brief SDLGetUserFriendlyMessageResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLGetUserFriendlyMessageResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLGetUserFriendlyMessageResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetUserFriendlyMessageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLGetUserFriendlyMessageResponse class destructor
- **/
- virtual ~SDLGetUserFriendlyMessageResponse();
+ /**
+ * @brief SDLGetUserFriendlyMessageResponse class destructor
+ **/
+ virtual ~SDLGetUserFriendlyMessageResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
index 9cffc8644d..6cf4646163 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
@@ -46,7 +46,8 @@ class SDLPolicyUpdate : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit SDLPolicyUpdate(const MessageSharedPtr& message);
+ SDLPolicyUpdate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
~SDLPolicyUpdate() OVERRIDE;
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h
index d3f7105523..53e9e796bf 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h
@@ -40,26 +40,27 @@ namespace application_manager {
namespace commands {
class SDLPolicyUpdateResponse : public ResponseFromHMI {
- public:
- /**
- * @brief SDLPolicyUpdateResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLPolicyUpdateResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief SDLPolicyUpdateResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLPolicyUpdateResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief SDLPolicyUpdateResponse class destructor
- **/
- virtual ~SDLPolicyUpdateResponse();
+ /**
+ * @brief SDLPolicyUpdateResponse class destructor
+ **/
+ virtual ~SDLPolicyUpdateResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdateResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdateResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h
index a25309e5d5..0f36e82b44 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h
@@ -49,7 +49,8 @@ class TTSChangeRegistrationRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSChangeRegistrationRequest(const MessageSharedPtr& message);
+ TTSChangeRegistrationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSChangeRegistrationRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h
index 73ad180286..ca9c114156 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h
@@ -49,7 +49,8 @@ class TTSChangeRegistratioResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSChangeRegistratioResponse(const MessageSharedPtr& message);
+ TTSChangeRegistratioResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSChangeRegistratioResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h
index 543945e8ef..bea41b7371 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h
@@ -49,7 +49,8 @@ class TTSGetCapabilitiesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetCapabilitiesRequest(const MessageSharedPtr& message);
+ TTSGetCapabilitiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetCapabilitiesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h
index 2fc16d1a40..a70ee2b33b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h
@@ -49,7 +49,8 @@ class TTSGetCapabilitiesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetCapabilitiesResponse(const MessageSharedPtr& message);
+ TTSGetCapabilitiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetCapabilitiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h
index e0ae0da0c4..627cf3da06 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h
@@ -49,7 +49,8 @@ class TTSGetLanguageRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetLanguageRequest(const MessageSharedPtr& message);
+ TTSGetLanguageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetLanguageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h
index 0d9df07ae6..f44492a6ed 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h
@@ -49,7 +49,8 @@ class TTSGetLanguageResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetLanguageResponse(const MessageSharedPtr& message);
+ TTSGetLanguageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetLanguageResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h
index 136edbb5f4..9500d54eea 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h
@@ -49,7 +49,8 @@ class TTSGetSupportedLanguagesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetSupportedLanguagesRequest(const MessageSharedPtr& message);
+ TTSGetSupportedLanguagesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetSupportedLanguagesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h
index 38e3c673bb..1bc569ebb8 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h
@@ -49,7 +49,8 @@ class TTSGetSupportedLanguagesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSGetSupportedLanguagesResponse(const MessageSharedPtr& message);
+ TTSGetSupportedLanguagesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSGetSupportedLanguagesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
index 676faabc01..81bd8eb27b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
@@ -49,7 +49,8 @@ class TTSIsReadyRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSIsReadyRequest(const MessageSharedPtr& message);
+ TTSIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSIsReadyRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h
index 12bb3bb870..833d3d0a82 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h
@@ -49,7 +49,8 @@ class TTSIsReadyResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSIsReadyResponse(const MessageSharedPtr& message);
+ TTSIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSIsReadyResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h
index 92a260d77f..b18e372b3e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h
@@ -49,7 +49,8 @@ class TTSSetGlobalPropertiesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSSetGlobalPropertiesRequest(const MessageSharedPtr& message);
+ TTSSetGlobalPropertiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSSetGlobalPropertiesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h
index 0766decf9f..aa7c85eece 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h
@@ -49,7 +49,8 @@ class TTSSetGlobalPropertiesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSSetGlobalPropertiesResponse(const MessageSharedPtr& message);
+ TTSSetGlobalPropertiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSSetGlobalPropertiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h
index f5555f6495..87384beedf 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h
@@ -42,15 +42,15 @@ namespace commands {
/**
* @brief TTSSpeakRequest command class
**/
-class TTSSpeakRequest
- : public RequestToHMI {
+class TTSSpeakRequest : public RequestToHMI {
public:
/**
* @brief TTSSpeakRequest class constructor
*
* @param message Incoming SmartObject message
**/
- explicit TTSSpeakRequest(const MessageSharedPtr& message);
+ TTSSpeakRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSSpeakRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h
index 541ea0d2ab..9f15afb33b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h
@@ -42,15 +42,15 @@ namespace commands {
/**
* @brief TTSSpeakResponse command class
**/
-class TTSSpeakResponse
- : public ResponseFromHMI {
+class TTSSpeakResponse : public ResponseFromHMI {
public:
/**
* @brief TTSSpeakResponse class constructor
*
* @param message Incoming SmartObject message
**/
- explicit TTSSpeakResponse(const MessageSharedPtr& message);
+ TTSSpeakResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSSpeakResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h
index 46c464425d..c51daee84d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h
@@ -49,7 +49,8 @@ class TTSStopSpeakingRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSStopSpeakingRequest(const MessageSharedPtr& message);
+ TTSStopSpeakingRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSStopSpeakingRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h
index aab8ca8c5b..a23889a733 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h
@@ -49,7 +49,8 @@ class TTSStopSpeakingResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit TTSStopSpeakingResponse(const MessageSharedPtr& message);
+ TTSStopSpeakingResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSStopSpeakingResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h
index 6b857818e7..294fd11912 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h
@@ -49,7 +49,8 @@ class UIAddCommandRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAddCommandRequest(const MessageSharedPtr& message);
+ UIAddCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAddCommandRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h
index c6a02fdd03..ed48e13322 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h
@@ -49,7 +49,8 @@ class UIAddCommandResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAddCommandResponse(const MessageSharedPtr& message);
+ UIAddCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAddCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h
index bba9a4c47e..96fa0557ae 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h
@@ -49,7 +49,8 @@ class UIAddSubmenuRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAddSubmenuRequest(const MessageSharedPtr& message);
+ UIAddSubmenuRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAddSubmenuRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h
index 0c4afc2fa3..62abf10b60 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h
@@ -49,7 +49,8 @@ class UIAddSubmenuResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAddSubmenuResponse(const MessageSharedPtr& message);
+ UIAddSubmenuResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAddSubmenuResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h
index 72cd733eb5..123246e596 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h
@@ -49,7 +49,8 @@ class UIAlertRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAlertRequest(const MessageSharedPtr& message);
+ UIAlertRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAlertRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h
index 97eb2ba94b..db48699a23 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h
@@ -49,7 +49,8 @@ class UIAlertResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIAlertResponse(const MessageSharedPtr& message);
+ UIAlertResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIAlertResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h
index 8e68dee2ec..744ed82cad 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h
@@ -49,7 +49,8 @@ class UIChangeRegistrationRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIChangeRegistrationRequest(const MessageSharedPtr& message);
+ UIChangeRegistrationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIChangeRegistrationRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h
index 50b092639b..57814b9acf 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h
@@ -49,7 +49,8 @@ class UIChangeRegistratioResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIChangeRegistratioResponse(const MessageSharedPtr& message);
+ UIChangeRegistratioResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIChangeRegistratioResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h
index 9eceb2eb6f..21a4c6dd42 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h
@@ -49,7 +49,8 @@ class UIDeleteCommandRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIDeleteCommandRequest(const MessageSharedPtr& message);
+ UIDeleteCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIDeleteCommandRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h
index c4d7ab6cac..c9baba728f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h
@@ -49,7 +49,8 @@ class UIDeleteCommandResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIDeleteCommandResponse(const MessageSharedPtr& message);
+ UIDeleteCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIDeleteCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h
index 24bf5878ff..d238e39a10 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h
@@ -49,7 +49,8 @@ class UIDeleteSubmenuRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIDeleteSubmenuRequest(const MessageSharedPtr& message);
+ UIDeleteSubmenuRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIDeleteSubmenuRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h
index 05d77c82d7..36d7bee528 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h
@@ -49,7 +49,8 @@ class UIDeleteSubmenuResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIDeleteSubmenuResponse(const MessageSharedPtr& message);
+ UIDeleteSubmenuResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIDeleteSubmenuResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h
index 06637fc8d4..d8bd10a9ca 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h
@@ -50,7 +50,8 @@ class UIEndAudioPassThruRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIEndAudioPassThruRequest(const MessageSharedPtr& message);
+ UIEndAudioPassThruRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIEndAudioPassThruRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h
index 6d5594f69f..c2a373d8c0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h
@@ -49,7 +49,8 @@ class UIEndAudioPassThruResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIEndAudioPassThruResponse(const MessageSharedPtr& message);
+ UIEndAudioPassThruResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIEndAudioPassThruResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h
index ad9a566078..cffba5ca42 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h
@@ -49,7 +49,8 @@ class UIGetCapabilitiesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetCapabilitiesRequest(const MessageSharedPtr& message);
+ UIGetCapabilitiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetCapabilitiesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h
index ce6ad6f7ef..525dd7ad9d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h
@@ -49,7 +49,8 @@ class UIGetCapabilitiesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetCapabilitiesResponse(const MessageSharedPtr& message);
+ UIGetCapabilitiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetCapabilitiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h
index 7371cd1031..4bf8e11d7e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h
@@ -49,7 +49,8 @@ class UIGetLanguageRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetLanguageRequest(const MessageSharedPtr& message);
+ UIGetLanguageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetLanguageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h
index f6536452ce..29bbba85ff 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h
@@ -49,7 +49,8 @@ class UIGetLanguageResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetLanguageResponse(const MessageSharedPtr& message);
+ UIGetLanguageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetLanguageResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h
index d0975e68da..94c197b7bc 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h
@@ -49,7 +49,8 @@ class UIGetSupportedLanguagesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetSupportedLanguagesRequest(const MessageSharedPtr& message);
+ UIGetSupportedLanguagesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetSupportedLanguagesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h
index c888c7b208..8962b77833 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h
@@ -49,7 +49,8 @@ class UIGetSupportedLanguagesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIGetSupportedLanguagesResponse(const MessageSharedPtr& message);
+ UIGetSupportedLanguagesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIGetSupportedLanguagesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
index 7cb4287244..a505df6de4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
@@ -49,7 +49,8 @@ class UIIsReadyRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIIsReadyRequest(const MessageSharedPtr& message);
+ UIIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIIsReadyRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h
index 64106654e9..93b2d9a569 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h
@@ -49,7 +49,8 @@ class UIIsReadyResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIIsReadyResponse(const MessageSharedPtr& message);
+ UIIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIIsReadyResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h
index 69566324f2..4cec5a5600 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h
@@ -49,7 +49,8 @@ class UIPerformAudioPassThruRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIPerformAudioPassThruRequest(const MessageSharedPtr& message);
+ UIPerformAudioPassThruRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIPerformAudioPassThruRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h
index c3283101f9..9fb502233f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h
@@ -49,7 +49,8 @@ class UIPerformAudioPassThruResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIPerformAudioPassThruResponse(const MessageSharedPtr& message);
+ UIPerformAudioPassThruResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIPerformAudioPassThruResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h
index d8e2f6c682..d9ae72a319 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h
@@ -49,7 +49,8 @@ class UIPerformInteractionRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIPerformInteractionRequest(const MessageSharedPtr& message);
+ UIPerformInteractionRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIPerformInteractionRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h
index 04286897a3..4db471bbae 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h
@@ -49,7 +49,8 @@ class UIPerformInteractionResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIPerformInteractionResponse(const MessageSharedPtr& message);
+ UIPerformInteractionResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIPerformInteractionResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h
index 06bfadbae7..8ba828a25e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h
@@ -49,7 +49,8 @@ class UIScrollableMessageRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIScrollableMessageRequest(const MessageSharedPtr& message);
+ UIScrollableMessageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIScrollableMessageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h
index 6d6d09c313..4ae432d658 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h
@@ -49,7 +49,8 @@ class UIScrollableMessageResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIScrollableMessageResponse(const MessageSharedPtr& message);
+ UIScrollableMessageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIScrollableMessageResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h
index 96f91d0f82..c016cf7cda 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h
@@ -49,7 +49,8 @@ class UISetAppIconRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetAppIconRequest(const MessageSharedPtr& message);
+ UISetAppIconRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISetIconRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h
index b323a91c36..640e43c9f4 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h
@@ -49,7 +49,8 @@ class UISetAppIconResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetAppIconResponse(const MessageSharedPtr& message);
+ UISetAppIconResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISetIconResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h
index 7e67912f53..573e9351b1 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h
@@ -42,26 +42,27 @@ namespace commands {
* @brief UiSetDisplayLayoutRequest command class
**/
class UiSetDisplayLayoutRequest : public RequestToHMI {
- public:
- /**
- * @brief UiSetDisplayLayoutRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit UiSetDisplayLayoutRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief UiSetDisplayLayoutRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UiSetDisplayLayoutRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief UiSetDisplayLayoutRequest class destructor
- **/
- virtual ~UiSetDisplayLayoutRequest();
+ /**
+ * @brief UiSetDisplayLayoutRequest class destructor
+ **/
+ virtual ~UiSetDisplayLayoutRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h
index 3e7a898af0..7b8098fdf5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief UiSetDisplayLayoutResponse command class
**/
class UiSetDisplayLayoutResponse : public ResponseFromHMI {
- public:
- /**
- * @brief UiSetDisplayLayoutResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit UiSetDisplayLayoutResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief UiSetDisplayLayoutResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UiSetDisplayLayoutResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief UiSetDisplayLayoutResponse class destructor
- **/
- virtual ~UiSetDisplayLayoutResponse();
+ /**
+ * @brief UiSetDisplayLayoutResponse class destructor
+ **/
+ virtual ~UiSetDisplayLayoutResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h
index 8b54e85332..83bf11e2e1 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h
@@ -49,7 +49,8 @@ class UISetGlobalPropertiesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetGlobalPropertiesRequest(const MessageSharedPtr& message);
+ UISetGlobalPropertiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIShowRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h
index b3cb38d49f..91de5e6df7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h
@@ -49,7 +49,8 @@ class UISetGlobalPropertiesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetGlobalPropertiesResponse(const MessageSharedPtr& message);
+ UISetGlobalPropertiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISetGlobalPropertiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h
index 1541aada6b..34bef8a989 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.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
@@ -49,7 +49,7 @@ class UISetIconRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetIconRequest(const MessageSharedPtr& message);
+ UISetIconRequest(const MessageSharedPtr& message);
/**
* @brief UISetIconRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h
index f125f64282..a9739bc802 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.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
@@ -49,7 +49,7 @@ class UISetIconResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetIconResponse(const MessageSharedPtr& message);
+ UISetIconResponse(const MessageSharedPtr& message);
/**
* @brief UISetIconResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h
index 443fc8d1a7..92565e6f02 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h
@@ -49,7 +49,8 @@ class UISetMediaClockTimerRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetMediaClockTimerRequest(const MessageSharedPtr& message);
+ UISetMediaClockTimerRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISetMediaClockTimerRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h
index 9358707117..0d71ff00f0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h
@@ -49,7 +49,8 @@ class UISetMediaClockTimerResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISetMediaClockTimerResponse(const MessageSharedPtr& message);
+ UISetMediaClockTimerResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISetMediaClockTimerResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h
index 136a99622b..80348de63b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h
@@ -49,7 +49,8 @@ class UIShowRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIShowRequest(const MessageSharedPtr& message);
+ UIShowRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIShowRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h
index 4a9b49253e..d696d2b9f8 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h
@@ -49,7 +49,8 @@ class UIShowResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UIShowResponse(const MessageSharedPtr& message);
+ UIShowResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UIShowResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h
index 8a3b37bfef..583f52084d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h
@@ -49,7 +49,8 @@ class UISliderRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISliderRequest(const MessageSharedPtr& message);
+ UISliderRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISliderRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h
index 2384f248aa..cabb54f6cb 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h
@@ -49,7 +49,8 @@ class UISliderResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UISliderResponse(const MessageSharedPtr& message);
+ UISliderResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UISliderResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h
index b606134409..61be04d04f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h
@@ -49,7 +49,8 @@ class UpdateAppListRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateAppListRequest(const MessageSharedPtr& message);
+ UpdateAppListRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateAppListRequest class destructor
@@ -70,4 +71,3 @@ class UpdateAppListRequest : public RequestToHMI {
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_
-
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h
index 135481cb0b..5ff8948393 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h
@@ -49,7 +49,8 @@ class UpdateAppListResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateAppListResponse(const MessageSharedPtr& message);
+ UpdateAppListResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateAppListResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h
index f645d312c5..c52ec96075 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h
@@ -53,7 +53,8 @@ class UpdateDeviceListRequest : public RequestToHMI,
*
* @param message Incoming SmartObject message
**/
- explicit UpdateDeviceListRequest(const MessageSharedPtr& message);
+ UpdateDeviceListRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateDeviceListRequest class destructor
@@ -73,14 +74,14 @@ class UpdateDeviceListRequest : public RequestToHMI,
*/
virtual void on_event(const event_engine::Event& event);
- /**
- * @brief Need to stop execution StopMethod if HMI did not started
- */
+ /**
+ * @brief Need to stop execution StopMethod if HMI did not started
+ */
virtual bool CleanUp();
private:
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::ConditionalVariable termination_condition_;
+ sync_primitives::Lock wait_hmi_lock;
+ sync_primitives::ConditionalVariable termination_condition_;
DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h
index 6ea2c1e528..1928b81207 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief UpdateDeviceListResponse command class
**/
class UpdateDeviceListResponse : public ResponseFromHMI {
- public:
- /**
- * @brief UpdateDeviceListResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit UpdateDeviceListResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief UpdateDeviceListResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UpdateDeviceListResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief UpdateDeviceListResponse class destructor
- **/
- virtual ~UpdateDeviceListResponse();
+ /**
+ * @brief UpdateDeviceListResponse class destructor
+ **/
+ virtual ~UpdateDeviceListResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h
index f84f93f2ed..d8be10da2e 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_SDL_REQUEST_H_
#include "application_manager/commands/hmi/request_to_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -49,7 +50,8 @@ class UpdateSDLRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateSDLRequest(const MessageSharedPtr& message);
+ UpdateSDLRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateSDLRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h
index b0d370ecfd..bc0375d5fa 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h
@@ -49,7 +49,8 @@ class UpdateSDLResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateSDLResponse(const MessageSharedPtr& message);
+ UpdateSDLResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateSDLResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h
index c60533d2ea..099f27b734 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h
@@ -49,7 +49,8 @@ class VIDiagnosticMessageRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIDiagnosticMessageRequest(const MessageSharedPtr& message);
+ VIDiagnosticMessageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIDiagnosticMessageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h
index 027e007e42..f0ae76ccb7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h
@@ -49,7 +49,8 @@ class VIDiagnosticMessageResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIDiagnosticMessageResponse(const MessageSharedPtr& message);
+ VIDiagnosticMessageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIDiagnosticMessageResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h
index 170eb895fd..3b7e502a57 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h
@@ -49,7 +49,8 @@ class VIGetDTCsRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetDTCsRequest(const MessageSharedPtr& message);
+ VIGetDTCsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetDTCsRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h
index 3ba4656d5b..7b7dab567b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h
@@ -49,7 +49,8 @@ class VIGetDTCsResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetDTCsResponse(const MessageSharedPtr& message);
+ VIGetDTCsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetDTCsResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h
index 7413b6bf3b..006f18e864 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h
@@ -49,7 +49,8 @@ class VIGetVehicleDataRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleDataRequest(const MessageSharedPtr& message);
+ VIGetVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetVehicleDataRequest class destructor
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..a11c763021 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
@@ -44,7 +44,7 @@ namespace commands {
*
* Template class for sending 1 subscribe thin request
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VIGetVehicleDataRequestTemplate : public RequestToHMI {
public:
/**
@@ -52,15 +52,15 @@ class VIGetVehicleDataRequestTemplate : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleDataRequestTemplate(const MessageSharedPtr& message)
- : RequestToHMI(message) {
- }
+ VIGetVehicleDataRequestTemplate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
/**
* @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.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h
index 1f9736b56a..ef19072bb0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -49,7 +50,8 @@ class VIGetVehicleDataResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleDataResponse(const MessageSharedPtr& message);
+ VIGetVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetVehicleDataResponse class destructor
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..a1c143baed 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
@@ -35,6 +35,7 @@
#include "application_manager/event_engine/event.h"
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
@@ -42,7 +43,7 @@ namespace commands {
/**
* @brief VIGetVehicleDataResponseTemplate command class
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VIGetVehicleDataResponseTemplate : public ResponseFromHMI {
public:
/**
@@ -50,18 +51,18 @@ class VIGetVehicleDataResponseTemplate : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleDataResponseTemplate(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
- }
+ VIGetVehicleDataResponseTemplate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
/**
* @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();
+ event.raise(application_manager_.event_dispatcher());
}
private:
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h
index 67d8ae046c..cd70c3349b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h
@@ -49,7 +49,8 @@ class VIGetVehicleTypeRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleTypeRequest(const MessageSharedPtr& message);
+ VIGetVehicleTypeRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetVehicleTypeRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h
index b36b193418..0ef35dd7fc 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h
@@ -49,7 +49,8 @@ class VIGetVehicleTypeResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIGetVehicleTypeResponse(const MessageSharedPtr& message);
+ VIGetVehicleTypeResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIGetVehicleTypeResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
index 061681029a..9049db4d24 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
@@ -49,7 +49,8 @@ class VIIsReadyRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIIsReadyRequest(const MessageSharedPtr& message);
+ VIIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIIsReadyRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h
index 52e00f85da..a7866a1e73 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_VI_IS_READY_RESPONSE_H_
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -49,7 +50,8 @@ class VIIsReadyResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIIsReadyResponse(const MessageSharedPtr& message);
+ VIIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIIsReadyResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h
index 6520db5e7d..cdbdb45a8b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h
@@ -49,7 +49,8 @@ class VIReadDIDRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIReadDIDRequest(const MessageSharedPtr& message);
+ VIReadDIDRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIReadDIDRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h
index 0855be454b..acb8760c5b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h
@@ -49,7 +49,8 @@ class VIReadDIDResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIReadDIDResponse(const MessageSharedPtr& message);
+ VIReadDIDResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIReadDIDResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h
index 1eb06c6217..58d4984f8d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h
@@ -49,7 +49,8 @@ class VISubscribeVehicleDataRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VISubscribeVehicleDataRequest(const MessageSharedPtr& message);
+ VISubscribeVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VISubscribeVehicleDataRequest class destructor
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..7fefe0dbe2 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
@@ -44,7 +44,7 @@ namespace commands {
*
* Template class for sending 1 subscribe thin request
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VISubscribeVehicleDataRequestTemplate : public RequestToHMI {
public:
/**
@@ -52,16 +52,15 @@ class VISubscribeVehicleDataRequestTemplate : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VISubscribeVehicleDataRequestTemplate(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
- }
+ VISubscribeVehicleDataRequestTemplate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
/**
* @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.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h
index b5e2788f32..8f038bf941 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h
@@ -49,7 +49,8 @@ class VISubscribeVehicleDataResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VISubscribeVehicleDataResponse(const MessageSharedPtr& message);
+ VISubscribeVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VISubscribeVehicleDataResponse class destructor
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..7790c57092 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
@@ -35,13 +35,14 @@
#include "application_manager/event_engine/event.h"
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
/**
* @brief VISubscriveVehicleDataResponseTemplate command class
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
public:
/**
@@ -49,20 +50,20 @@ class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VISubscribeVehicleDataResponseTemplate(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
- }
+ VISubscribeVehicleDataResponseTemplate(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
/**
* @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();
+ event.raise(application_manager_.event_dispatcher());
}
+
private:
DISALLOW_COPY_AND_ASSIGN(VISubscribeVehicleDataResponseTemplate<eventID>);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h
index 1320ae477a..b99eee47e7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h
@@ -49,7 +49,8 @@ class VIUnsubscribeVehicleDataRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIUnsubscribeVehicleDataRequest(const MessageSharedPtr& message);
+ VIUnsubscribeVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIUnsubscribeVehicleDataRequest class destructor
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..b9367a372e 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
@@ -44,7 +44,7 @@ namespace commands {
*
* Template class for sending 1 unsubscribe thin request
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI {
public:
/**
@@ -52,16 +52,15 @@ class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIUnsubscribeVehicleDataRequestTemplate(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
- }
+ VIUnsubscribeVehicleDataRequestTemplate(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
/**
* @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.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h
index 8818709afe..3f930b5a5b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h
@@ -49,7 +49,8 @@ class VIUnsubscribeVehicleDataResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIUnsubscribeVehicleDataResponse(const MessageSharedPtr& message);
+ VIUnsubscribeVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VIUnsubscribeVehicleDataResponse class destructor
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..9d943b838d 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
@@ -35,6 +35,7 @@
#include "application_manager/event_engine/event.h"
#include "application_manager/commands/hmi/response_from_hmi.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
@@ -42,7 +43,7 @@ namespace commands {
/**
* @brief VIUnsubscriveVehicleDataResponseTemplate command class
**/
-template<event_engine::Event::EventID eventID>
+template <event_engine::Event::EventID eventID>
class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
public:
/**
@@ -50,20 +51,20 @@ class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VIUnsubscribeVehicleDataResponseTemplate(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
- }
+ VIUnsubscribeVehicleDataResponseTemplate(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
/**
* @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();
+ event.raise(application_manager_.event_dispatcher());
}
+
private:
DISALLOW_COPY_AND_ASSIGN(VIUnsubscribeVehicleDataResponseTemplate<eventID>);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h
index 9fdc3f776f..1ef4125c89 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h
@@ -49,7 +49,8 @@ class VRAddCommandRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRAddCommandRequest(const MessageSharedPtr& message);
+ VRAddCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRAddCommandRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h
index 7418ed5865..1b419ed6ec 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h
@@ -49,7 +49,8 @@ class VRAddCommandResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRAddCommandResponse(const MessageSharedPtr& message);
+ VRAddCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRAddCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h
index 53584ee970..642319e8d6 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h
@@ -49,7 +49,8 @@ class VRChangeRegistrationRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRChangeRegistrationRequest(const MessageSharedPtr& message);
+ VRChangeRegistrationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRChangeRegistrationRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h
index d71a14da34..8dc5e96729 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h
@@ -49,7 +49,8 @@ class VRChangeRegistrationResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRChangeRegistrationResponse(const MessageSharedPtr& message);
+ VRChangeRegistrationResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRChangeRegistrationResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h
index 91a5dc7d99..bc5c24a350 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h
@@ -49,7 +49,8 @@ class VRDeleteCommandRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRDeleteCommandRequest(const MessageSharedPtr& message);
+ VRDeleteCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRDeleteCommandRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h
index ad8c82e38c..526c296321 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h
@@ -49,7 +49,8 @@ class VRDeleteCommandResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRDeleteCommandResponse(const MessageSharedPtr& message);
+ VRDeleteCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRDeleteCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h
index 676967083f..8dcc240e9b 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief VRGetCapabilitiesRequest command class
**/
class VRGetCapabilitiesRequest : public RequestToHMI {
- public:
- /**
- * @brief VRGetCapabilitiesRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit VRGetCapabilitiesRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief VRGetCapabilitiesRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ VRGetCapabilitiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief VRGetCapabilitiesRequest class destructor
- **/
- virtual ~VRGetCapabilitiesRequest();
+ /**
+ * @brief VRGetCapabilitiesRequest class destructor
+ **/
+ virtual ~VRGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h
index 8b88eb4e3b..b6c8e081f5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief VRGetCapabilitiesResponse command class
**/
class VRGetCapabilitiesResponse : public ResponseFromHMI {
- public:
- /**
- * @brief VRGetCapabilitiesResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit VRGetCapabilitiesResponse(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief VRGetCapabilitiesResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ VRGetCapabilitiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief VRGetCapabilitiesResponse class destructor
- **/
- virtual ~VRGetCapabilitiesResponse();
+ /**
+ * @brief VRGetCapabilitiesResponse class destructor
+ **/
+ virtual ~VRGetCapabilitiesResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesResponse);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesResponse);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h
index 9dd9133ffd..05373784f3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h
@@ -49,7 +49,8 @@ class VRGetLanguageRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRGetLanguageRequest(const MessageSharedPtr& message);
+ VRGetLanguageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRGetLanguageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h
index d9c4fc2126..fad2f219df 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h
@@ -49,7 +49,8 @@ class VRGetLanguageResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRGetLanguageResponse(const MessageSharedPtr& message);
+ VRGetLanguageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRGetLanguageResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h
index 0a010cdfec..6ed56ebd32 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h
@@ -49,7 +49,8 @@ class VRGetSupportedLanguagesRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRGetSupportedLanguagesRequest(const MessageSharedPtr& message);
+ VRGetSupportedLanguagesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRGetSupportedLanguagesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h
index dbbe57ba36..c4e742ecd0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h
@@ -49,7 +49,8 @@ class VRGetSupportedLanguagesResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRGetSupportedLanguagesResponse(const MessageSharedPtr& message);
+ VRGetSupportedLanguagesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRGetSupportedLanguagesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
index e66c9c36a5..9fc4ccd2f3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
@@ -49,7 +49,8 @@ class VRIsReadyRequest : public RequestToHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRIsReadyRequest(const MessageSharedPtr& message);
+ VRIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRIsReadyRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h
index a9b1a68455..474b3373a3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h
@@ -49,7 +49,8 @@ class VRIsReadyResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRIsReadyResponse(const MessageSharedPtr& message);
+ VRIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief VRIsReadyResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h
index b819fdb927..35a7e80b06 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h
@@ -43,26 +43,27 @@ namespace commands {
* @brief VRPerformInteractionRequest command class
**/
class VRPerformInteractionRequest : public RequestToHMI {
- public:
- /**
- * @brief VRPerformInteractionRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit VRPerformInteractionRequest(const MessageSharedPtr& message);
+ public:
+ /**
+ * @brief VRPerformInteractionRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ VRPerformInteractionRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief VRPerformInteractionRequest class destructor
- **/
- virtual ~VRPerformInteractionRequest();
+ /**
+ * @brief VRPerformInteractionRequest class destructor
+ **/
+ virtual ~VRPerformInteractionRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(VRPerformInteractionRequest);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VRPerformInteractionRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h
index ffbbd613e2..7c445416ce 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h
@@ -49,7 +49,8 @@ class VRPerformInteractionResponse : public ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- explicit VRPerformInteractionResponse(const MessageSharedPtr& message);
+ VRPerformInteractionResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief TTSPerformInteractionResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
index 2c36d8425e..22a0c7e85f 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
@@ -52,7 +52,8 @@ class AddCommandRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AddCommandRequest(const MessageSharedPtr& message);
+ AddCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AddCommandRequest class destructor
@@ -72,7 +73,6 @@ class AddCommandRequest : public CommandRequestImpl {
void on_event(const event_engine::Event& event);
private:
-
/*
* @brief Check if command name doesn't exist in application
* Please see SDLAQ-CRS-407 for more information
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h
index 67a49a8e17..84bcdebc31 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h
@@ -51,7 +51,8 @@ class AddCommandResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AddCommandResponse(const MessageSharedPtr& message);
+ AddCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AddCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
index befeb76d9f..1f12523953 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
@@ -51,7 +51,8 @@ class AddSubMenuRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AddSubMenuRequest(const MessageSharedPtr& message);
+ AddSubMenuRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AddSubMenuRequest class destructor
@@ -71,7 +72,6 @@ class AddSubMenuRequest : public CommandRequestImpl {
void on_event(const event_engine::Event& event);
private:
-
/*
* @brief Check if submenu name is valid
*
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h
index 62c404951a..4d71e5f017 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h
@@ -51,7 +51,8 @@ class AddSubMenuResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AddSubMenuResponse(const MessageSharedPtr& message);
+ AddSubMenuResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AddSubMenuResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
index 02423f0630..472ff45551 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
@@ -53,7 +53,8 @@ class AlertManeuverRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AlertManeuverRequest(const MessageSharedPtr& message);
+ AlertManeuverRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AlertManeuverRequest class destructor
@@ -81,8 +82,10 @@ class AlertManeuverRequest : public CommandRequestImpl {
*/
bool IsWhiteSpaceExist();
- mobile_apis::Result::eType tts_speak_result_code_;
- mobile_apis::Result::eType navi_alert_maneuver_result_code_;
+ mobile_apis::Result::eType tts_speak_result_code_;
+ mobile_apis::Result::eType navi_alert_maneuver_result_code_;
+ std::string info_navi_;
+ std::string info_tts_;
Pending pending_requests_;
DISALLOW_COPY_AND_ASSIGN(AlertManeuverRequest);
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h
index 5f0827699b..c02322e298 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h
@@ -51,7 +51,8 @@ class AlertManeuverResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AlertManeuverResponse(const MessageSharedPtr& message);
+ AlertManeuverResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AlertManeuverResponse class destructor
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..bc99665d82 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
@@ -52,7 +52,8 @@ class AlertRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AlertRequest(const MessageSharedPtr& message);
+ AlertRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AlertRequest class destructor
@@ -71,7 +72,8 @@ class AlertRequest : public CommandRequestImpl {
/*
* @brief Will caled by request controller, when default will be expired.
- * If Alert request has soft buttons, timeout response should not be sent to mobile
+ * If Alert request has soft buttons, timeout response should not be sent to
+ * mobile
*/
virtual void onTimeOut();
@@ -83,7 +85,6 @@ class AlertRequest : public CommandRequestImpl {
void on_event(const event_engine::Event& event);
protected:
-
private:
/*
* @brief Checks if request parameters are valid
@@ -102,15 +103,16 @@ 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
@@ -124,14 +126,14 @@ class AlertRequest : public CommandRequestImpl {
*/
bool CheckStringsOfAlertRequest();
- 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 awaiting_ui_alert_response_;
+ bool awaiting_tts_speak_response_;
+ bool awaiting_tts_stop_speaking_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/alert_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h
index 59b38933a7..acac21d738 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h
@@ -51,7 +51,8 @@ class AlertResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit AlertResponse(const MessageSharedPtr& message);
+ AlertResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief AlertResponse class destructor
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..c81ed0b5d3 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,22 +39,26 @@
#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
*
* @param message Incoming SmartObject message
**/
- explicit ChangeRegistrationRequest(const MessageSharedPtr& message);
+ ChangeRegistrationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ChangeRegistrationRequest class destructor
@@ -107,9 +111,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 +122,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 {
+ 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/change_registration_response.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h
index 2cac5f2d58..6ff3fd9a4a 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h
@@ -51,7 +51,8 @@ class ChangeRegistrationResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ChangeRegistrationResponse(const MessageSharedPtr& message);
+ ChangeRegistrationResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ChangeRegistrationResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
index b9992fc1fe..32fed1eee1 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
@@ -53,188 +53,186 @@ namespace commands {
**/
class CreateInteractionChoiceSetRequest : public CommandRequestImpl {
public:
- /**
- * @brief CreateInteractionChoiceSetRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit CreateInteractionChoiceSetRequest(const MessageSharedPtr& message);
-
- /**
- * @brief CreateInteractionChoiceSetRequest class destructor
- **/
- virtual ~CreateInteractionChoiceSetRequest();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
+ /**
+ * @brief CreateInteractionChoiceSetRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CreateInteractionChoiceSetRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief CreateInteractionChoiceSetRequest class destructor
+ **/
+ virtual ~CreateInteractionChoiceSetRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
private:
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- virtual void on_event(const event_engine::Event& event);
-
- /**
- * @brief Function is called by RequestController when request execution time
- * has exceed it's limit
- */
- virtual void onTimeOut();
- /**
- * @brief DeleteChoices allows to walk through the sent commands collection
- * in order to sent appropriate DeleteCommand request.
- */
- void DeleteChoices();
-
- /**
- * @brief Calls after all responses from HMI were received.
- * Terminates request and sends successful response to mobile
- * if all responses were SUCCESS or calls DeleteChoices in other case.
- */
- void OnAllHMIResponsesReceived();
-
- /**
- * @brief The VRCommand struct
- * Collect minimum information about sent VR commands, for correctly
- * processing deleting sent commands if error from HMI received
- */
- struct VRCommandInfo {
- VRCommandInfo():
- cmd_id_(0),
- succesful_response_received_(false) {}
- explicit VRCommandInfo(uint32_t cmd_id):
- cmd_id_(cmd_id),
- succesful_response_received_(false) {}
- uint32_t cmd_id_;
- bool succesful_response_received_;
- };
-
- typedef std::map<uint32_t, VRCommandInfo> SentCommandsMap;
- SentCommandsMap sent_commands_map_;
-
- int32_t choice_set_id_;
- size_t expected_chs_count_;
- size_t received_chs_count_;
-
- /**
- * @brief Flag for stop sending VR commands to HMI, in case one of responses
- * failed
- */
- volatile bool error_from_hmi_;
- sync_primitives::Lock error_from_hmi_lock_;
-
- /**
- * @brief Flag shows if request already was expired by timeout
- */
- volatile bool is_timed_out_;
- sync_primitives::Lock is_timed_out_lock_;
-
- sync_primitives::Lock vr_commands_lock_;
- /*
- * @brief Sends VR AddCommand request to HMI
- *
- * @param app_id Application ID
- *
- */
- void SendVRAddCommandRequests(ApplicationSharedPtr const app);
-
- /*
- * @brief Checks incoming choiseSet params.
- * @param app Registred mobile application
- *
- * @return Mobile result code
- */
- mobile_apis::Result::eType CheckChoiceSet(ApplicationConstSharedPtr app);
-
- /*
- * @brief Predicate for using with CheckChoiceSet method to compare choice ID param
- *
- * return TRUE if there is coincidence of choice ID, otherwise FALSE
- */
- struct CoincidencePredicateChoiceID {
- explicit CoincidencePredicateChoiceID(const uint32_t newItem)
- : newItem_(newItem)
- {}
-
- bool operator()(smart_objects::SmartObject obj) {
- return obj[strings::choice_id].asUInt() == newItem_;
- }
-
- const uint32_t newItem_;
- };
-
- /*
- * @brief Predicate for using with CheckChoiceSet method to compare menu name param
- *
- * return TRUE if there is coincidence of menu name, otherwise FALSE
- */
- struct CoincidencePredicateMenuName {
- explicit CoincidencePredicateMenuName(const std::string& newItem)
- : newItem_(newItem)
- {};
-
- bool operator()(smart_objects::SmartObject obj) {
- return obj[strings::menu_name].asString() == newItem_;
- }
-
- const std::string& newItem_;
- };
-
- /*
- * @brief Predicate for using with CheckChoiceSet method to compare VR commands param
- *
- * return TRUE if there is coincidence of VR commands, otherwise FALSE
- */
- struct CoincidencePredicateVRCommands {
- explicit CoincidencePredicateVRCommands(
- const smart_objects::SmartObject& newItem): newItem_(newItem) {}
-
- bool operator()(smart_objects::SmartObject obj) {
- return compareStr(obj, newItem_);
- }
-
- const smart_objects::SmartObject& newItem_;
- };
-
- /*
- * @brief Checks if incoming choice set doesn't has similar VR synonyms.
- *
- * @param choice1 Choice to compare
- * @param choice2 Choice to compare
- *
- * return Return TRUE if there are similar VR synonyms in choice set,
- * otherwise FALSE
- */
- bool compareSynonyms(
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const event_engine::Event& event);
+
+ /**
+ * @brief Function is called by RequestController when request execution time
+ * has exceed it's limit
+ */
+ virtual void onTimeOut();
+ /**
+ * @brief DeleteChoices allows to walk through the sent commands collection
+ * in order to sent appropriate DeleteCommand request.
+ */
+ void DeleteChoices();
+
+ /**
+ * @brief Calls after all responses from HMI were received.
+ * Terminates request and sends successful response to mobile
+ * if all responses were SUCCESS or calls DeleteChoices in other case.
+ */
+ void OnAllHMIResponsesReceived();
+
+ /**
+ * @brief The VRCommand struct
+ * Collect minimum information about sent VR commands, for correctly
+ * processing deleting sent commands if error from HMI received
+ */
+ struct VRCommandInfo {
+ VRCommandInfo()
+ : cmd_id_(0), succesful_response_received_(false) {}
+ VRCommandInfo(uint32_t cmd_id)
+ : cmd_id_(cmd_id), succesful_response_received_(false) {}
+ uint32_t cmd_id_;
+ bool succesful_response_received_;
+ };
+
+ typedef std::map<uint32_t, VRCommandInfo> SentCommandsMap;
+ SentCommandsMap sent_commands_map_;
+
+ int32_t choice_set_id_;
+ size_t expected_chs_count_;
+ size_t received_chs_count_;
+
+ /**
+ * @brief Flag for stop sending VR commands to HMI, in case one of responses
+ * failed
+ */
+ volatile bool error_from_hmi_;
+ sync_primitives::Lock error_from_hmi_lock_;
+
+ /**
+ * @brief Flag shows if request already was expired by timeout
+ */
+ volatile bool is_timed_out_;
+ sync_primitives::Lock is_timed_out_lock_;
+
+ sync_primitives::Lock vr_commands_lock_;
+ /*
+ * @brief Sends VR AddCommand request to HMI
+ *
+ * @param app_id Application ID
+ *
+ */
+ void SendVRAddCommandRequests(ApplicationSharedPtr const app);
+
+ /*
+ * @brief Checks incoming choiseSet params.
+ * @param app Registred mobile application
+ *
+ * @return Mobile result code
+ */
+ mobile_apis::Result::eType CheckChoiceSet(ApplicationConstSharedPtr app);
+
+ /*
+ * @brief Predicate for using with CheckChoiceSet method to compare choice ID
+ *param
+ *
+ * return TRUE if there is coincidence of choice ID, otherwise FALSE
+ */
+ struct CoincidencePredicateChoiceID {
+ CoincidencePredicateChoiceID(const uint32_t newItem) : newItem_(newItem) {}
+
+ bool operator()(smart_objects::SmartObject obj) {
+ return obj[strings::choice_id].asUInt() == newItem_;
+ }
+
+ const uint32_t newItem_;
+ };
+
+ /*
+ * @brief Predicate for using with CheckChoiceSet method to compare menu name
+ *param
+ *
+ * return TRUE if there is coincidence of menu name, otherwise FALSE
+ */
+ struct CoincidencePredicateMenuName {
+ CoincidencePredicateMenuName(const std::string& newItem)
+ : newItem_(newItem){};
+
+ bool operator()(smart_objects::SmartObject obj) {
+ return obj[strings::menu_name].asString() == newItem_;
+ }
+
+ const std::string& newItem_;
+ };
+
+ /*
+ * @brief Predicate for using with CheckChoiceSet method to compare VR commands
+ *param
+ *
+ * return TRUE if there is coincidence of VR commands, otherwise FALSE
+ */
+ struct CoincidencePredicateVRCommands {
+ CoincidencePredicateVRCommands(const smart_objects::SmartObject& newItem)
+ : newItem_(newItem) {}
+
+ bool operator()(smart_objects::SmartObject obj) {
+ return compareStr(obj, newItem_);
+ }
+
+ const smart_objects::SmartObject& newItem_;
+ };
+
+ /*
+ * @brief Checks if incoming choice set doesn't has similar VR synonyms.
+ *
+ * @param choice1 Choice to compare
+ * @param choice2 Choice to compare
+ *
+ * return Return TRUE if there are similar VR synonyms in choice set,
+ * otherwise FALSE
+ */
+ bool compareSynonyms(
const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2);
- /*
- * @brief Checks VR synonyms ignoring differences in case.
- *
- * @param str1 VR synonym to compare
- * @param str2 VR synonym to compare
- *
- * return Return TRUE if there are similar VR synonyms in choice set,
- * otherwise FALSE
- */
- static bool compareStr(
+ /*
+ * @brief Checks VR synonyms ignoring differences in case.
+ *
+ * @param str1 VR synonym to compare
+ * @param str2 VR synonym to compare
+ *
+ * return Return TRUE if there are similar VR synonyms in choice set,
+ * otherwise FALSE
+ */
+ static bool compareStr(
const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1,
const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2);
- /**
- * @brief Checks choice set params(menuName, tertiaryText, ...)
- * When type is String there is a check on the contents \t\n \\t \\n
- * @param choice_set which must check
- * @return if choice_set contains \t\n \\t \\n return TRUE, FALSE otherwise
- */
- bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set);
+ /**
+ * @brief Checks choice set params(menuName, tertiaryText, ...)
+ * When type is String there is a check on the contents \t\n \\t \\n
+ * @param choice_set which must check
+ * @return if choice_set contains \t\n \\t \\n return TRUE, FALSE otherwise
+ */
+ bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set);
- DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest);
+ DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h
index 965573f4a4..6a7faf705c 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h
@@ -51,7 +51,8 @@ class CreateInteractionChoiceSetResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit CreateInteractionChoiceSetResponse(const MessageSharedPtr& message);
+ CreateInteractionChoiceSetResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief CreateInteractionChoiceSetResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
index bae0fedd54..6a19014c96 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
@@ -51,7 +51,8 @@ class DeleteCommandRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteCommandRequest(const MessageSharedPtr& message);
+ DeleteCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteCommandRequest class destructor
@@ -71,7 +72,6 @@ class DeleteCommandRequest : public CommandRequestImpl {
void on_event(const event_engine::Event& event);
private:
-
DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest);
/*
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h
index 0fe0f0959b..b61035ca1b 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h
@@ -51,7 +51,8 @@ class DeleteCommandResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteCommandResponse(const MessageSharedPtr& message);
+ DeleteCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteCommandResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h
index 4927227465..adaf2686bc 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h
@@ -53,7 +53,8 @@ class DeleteFileRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteFileRequest(const MessageSharedPtr& message);
+ DeleteFileRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteFileRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h
index cfe6aaa4fa..e001e46a22 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h
@@ -51,7 +51,8 @@ class DeleteFileResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteFileResponse(const MessageSharedPtr& message);
+ DeleteFileResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteFileResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h
index 283b882fad..716a1d82de 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h
@@ -52,7 +52,8 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message);
+ DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteInteractionChoiceSetRequest class destructor
@@ -65,7 +66,6 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl {
virtual void Run();
private:
-
/*
* @brief Check if requested choice set ID in use by perform interaction
*
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h
index 1f641e15b3..86e20bc6d4 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h
@@ -51,7 +51,8 @@ class DeleteInteractionChoiceSetResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message);
+ DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteInteractionChoiceSetResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h
index 6687218051..7c48de5d8e 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h
@@ -52,7 +52,8 @@ class DeleteSubMenuRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteSubMenuRequest(const MessageSharedPtr& message);
+ DeleteSubMenuRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteSubMenuRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h
index 0bb080e93e..76232aee4b 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h
@@ -51,7 +51,8 @@ class DeleteSubMenuResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DeleteSubMenuResponse(const MessageSharedPtr& message);
+ DeleteSubMenuResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DeleteSubMenuResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h
index 4cda040b42..34c8b0e872 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h
@@ -51,7 +51,8 @@ class DiagnosticMessageRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DiagnosticMessageRequest(const MessageSharedPtr& message);
+ DiagnosticMessageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DiagnosticMessageRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h
index 1b6a6024f4..439f11a57e 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h
@@ -51,7 +51,8 @@ class DiagnosticMessageResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DiagnosticMessageResponse(const MessageSharedPtr& message);
+ DiagnosticMessageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DiagnosticMessageResponse class destructor
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 ea8556f6e0..1b945fc5fb 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
@@ -48,7 +48,8 @@ class DialNumberRequest : public CommandRequestImpl {
/**
* \brief DialNumberRequest class constructor
**/
- explicit DialNumberRequest(const MessageSharedPtr& message);
+ DialNumberRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief DialNumberRequest class destructor
@@ -58,11 +59,11 @@ class DialNumberRequest : public CommandRequestImpl {
/**
* @brief Initialize request params
**/
- bool Init() OVERRIDE;
+ bool Init() OVERRIDE;
/**
- * @brief Execute command
- **/
+ * @brief Execute command
+ **/
void Run() OVERRIDE;
/**
@@ -73,13 +74,12 @@ class DialNumberRequest : public CommandRequestImpl {
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);
+ 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
index 0cdeb9eb90..4a6980bd04 100644
--- 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
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2016, Ford Motor Company
+
+ Copyright (c) 2013, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -50,17 +51,18 @@ class DialNumberResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit DialNumberResponse(const MessageSharedPtr& message);
+ DialNumberResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief DialNumberResponse class destructor
**/
- ~DialNumberResponse() OVERRIDE;
+ virtual ~DialNumberResponse();
/**
* @brief Execute command
**/
- void Run() OVERRIDE;
+ virtual void Run();
private:
DISALLOW_COPY_AND_ASSIGN(DialNumberResponse);
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h
index f291f7a748..add6d2497e 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h
@@ -51,7 +51,8 @@ class EndAudioPassThruRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit EndAudioPassThruRequest(const MessageSharedPtr& message);
+ EndAudioPassThruRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief EndAudioPassThruRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h
index 5ad5f85e6e..381a397fbd 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h
@@ -51,7 +51,8 @@ class EndAudioPassThruResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit EndAudioPassThruResponse(const MessageSharedPtr& message);
+ EndAudioPassThruResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief EndAudioPassThruResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h
index 1fb931d508..9ccef12152 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h
@@ -45,15 +45,14 @@ class GenericResponse : public CommandResponseImpl {
/**
* \brief GenericResponse class constructor
**/
- explicit GenericResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
- }
+ GenericResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
/**
* \brief GenericResponse class destructor
**/
- virtual ~GenericResponse() {
- }
+ virtual ~GenericResponse() {}
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h
index d76ac253bc..d962937e39 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h
@@ -51,7 +51,8 @@ class GetDTCsRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit GetDTCsRequest(const MessageSharedPtr& message);
+ GetDTCsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief GetDTCsRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h
index 69ff1fca59..abe970d60f 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h
@@ -51,7 +51,8 @@ class GetDTCsResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit GetDTCsResponse(const MessageSharedPtr& message);
+ GetDTCsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief GetDTCsResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h
index db9db7b0a7..eda77e59b0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h
@@ -53,7 +53,8 @@ class GetVehicleDataRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit GetVehicleDataRequest(const MessageSharedPtr& message);
+ GetVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief GetVehicleDataRequest class destructor
@@ -65,7 +66,6 @@ class GetVehicleDataRequest : public CommandRequestImpl {
**/
virtual void Run();
-
protected:
virtual void on_event(const event_engine::Event& event);
@@ -83,7 +83,7 @@ class GetVehicleDataRequest : public CommandRequestImpl {
typedef std::vector<HmiRequest> HmiRequests;
HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
DISALLOW_COPY_AND_ASSIGN(GetVehicleDataRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h
index f0306df6aa..4fadaf2b01 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h
@@ -51,7 +51,8 @@ class GetVehicleDataResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit GetVehicleDataResponse(const MessageSharedPtr& message);
+ GetVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief GetVehicleDataResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h
new file mode 100644
index 0000000000..bf23121177
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h
@@ -0,0 +1,77 @@
+/*
+ * 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_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief GetWayPointsRequest command class
+ **/
+class GetWayPointsRequest : public CommandRequestImpl {
+ public:
+ /**
+ * \brief GetWayPointsRequest class constructor
+ **/
+ GetWayPointsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * \brief GetWayPointsRequest class destructor
+ **/
+ virtual ~GetWayPointsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_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/mobile/get_way_points_response.h
index aa82de4d89..cb4f840763 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/mobile/get_way_points_response.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
@@ -30,43 +30,43 @@
* 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_MOBILE_GET_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_
-#include "application_manager/commands/hmi/notification_from_hmi.h"
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
namespace application_manager {
namespace commands {
/**
- * @brief OnEmergencyEventNotification command class
+ * @brief GetWayPointsResponse command class
**/
-class OnEmergencyEventNotification : public NotificationFromHMI {
- public:
- /**
- * @brief OnEmergencyEventNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnEmergencyEventNotification(const MessageSharedPtr& message);
+class GetWayPointsResponse : public CommandResponseImpl {
+ public:
+ /**
+ * \brief GetWayPointsResponse class constructor
+ **/
+ GetWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
- /**
- * @brief OnEmergencyEventNotification class destructor
- **/
- virtual ~OnEmergencyEventNotification();
+ /**
+ * \brief GetWayPointsResponse class destructor
+ **/
+ virtual ~GetWayPointsResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
- private:
- DISALLOW_COPY_AND_ASSIGN(OnEmergencyEventNotification);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetWayPointsResponse);
};
} // 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_MOBILE_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h
index 86171f1ff8..d8d28b7e9d 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h
@@ -51,7 +51,8 @@ class ListFilesRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ListFilesRequest(const MessageSharedPtr& message);
+ ListFilesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ListFilesRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h
index 6f8e80bae2..a211ee5968 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h
@@ -51,7 +51,8 @@ class ListFilesResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ListFilesResponse(const MessageSharedPtr& message);
+ ListFilesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ListFilesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h
index 8753660470..7ef2e7e5d2 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h
@@ -51,8 +51,8 @@ class OnAppInterfaceUnregisteredNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnAppInterfaceUnregisteredNotification(
- const MessageSharedPtr& message);
+ OnAppInterfaceUnregisteredNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager);
/**
* @brief OnAppInterfaceUnregisteredNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h
index 67bc319771..b74d8fbe41 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h
@@ -42,7 +42,8 @@ namespace application_manager {
namespace commands {
/**
- * @brief OnAudioPassThruNotification class used to send notification with binary data written from
+ * @brief OnAudioPassThruNotification class used to send notification with
+ *binary data written from
* microphone to mobile device while PerformAudioPassThru is active.
**/
class OnAudioPassThruNotification : public CommandNotificationImpl {
@@ -52,7 +53,8 @@ class OnAudioPassThruNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnAudioPassThruNotification(const MessageSharedPtr& message);
+ OnAudioPassThruNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnAudioPassThruNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h
index d1297ba980..80355993e1 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h
@@ -55,7 +55,8 @@ class OnButtonEventNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnButtonEventNotification(const MessageSharedPtr& message);
+ OnButtonEventNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnButtonEventNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h
index 0ebdb6d7c6..1443e58a70 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h
@@ -55,7 +55,8 @@ class OnButtonPressNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnButtonPressNotification(const MessageSharedPtr& message);
+ OnButtonPressNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnButtonEventCommand class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h
index 751b1e7dd2..3f9a0ad6c2 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h
@@ -54,7 +54,8 @@ class OnCommandNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnCommandNotification(const MessageSharedPtr& message);
+ OnCommandNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnCommandNotification class destructor
@@ -65,6 +66,7 @@ class OnCommandNotification : public CommandNotificationImpl {
* @brief Execute command
**/
virtual void Run();
+
private:
DISALLOW_COPY_AND_ASSIGN(OnCommandNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h
index 2f2a3c81fc..ee3c19c707 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h
@@ -53,7 +53,8 @@ class OnDriverDistractionNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnDriverDistractionNotification(const MessageSharedPtr& message);
+ OnDriverDistractionNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnDriverDistractionNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h
index be83047863..9f9fad16d4 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h
@@ -52,7 +52,8 @@ class OnHashChangeNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnHashChangeNotification(const MessageSharedPtr& message);
+ OnHashChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnHashChangeNotification class destructor
@@ -68,7 +69,7 @@ class OnHashChangeNotification : public CommandNotificationImpl {
DISALLOW_COPY_AND_ASSIGN(OnHashChangeNotification);
};
-} // namespace mobile
+} // namespace mobile
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h
index 11d82925ec..a82182eea0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h
@@ -51,7 +51,8 @@ class OnHMIStatusNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnHMIStatusNotification(const MessageSharedPtr& message);
+ OnHMIStatusNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnHMIStatusNotification class destructor
@@ -63,7 +64,7 @@ class OnHMIStatusNotification : public CommandNotificationImpl {
**/
virtual void Run();
-private:
+ private:
DISALLOW_COPY_AND_ASSIGN(OnHMIStatusNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h
index 70a8bf745b..878f4fa720 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_
#include "application_manager/commands/command_notification_from_mobile_impl.h"
+#include "application_manager/application_manager.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -45,15 +46,16 @@ namespace commands {
/**
* @brief OnHMIStatusNotificationFromMobile class
**/
-class OnHMIStatusNotificationFromMobile :
- public CommandNotificationFromMobileImpl {
+class OnHMIStatusNotificationFromMobile
+ : public CommandNotificationFromMobileImpl {
public:
/**
* @brief OnHMIStatusNotificationFromMobile class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message);
+ OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnHMIStatusNotificationFromMobile class destructor
@@ -65,7 +67,7 @@ class OnHMIStatusNotificationFromMobile :
**/
virtual void Run();
-private:
+ private:
DISALLOW_COPY_AND_ASSIGN(OnHMIStatusNotificationFromMobile);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h
index e0d6a258e9..911ca70cdf 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h
@@ -53,7 +53,8 @@ class OnKeyBoardInputNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnKeyBoardInputNotification(const MessageSharedPtr& message);
+ OnKeyBoardInputNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnKeyBoardInputNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h
index d163114890..c62652ff67 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h
@@ -51,7 +51,8 @@ class OnLanguageChangeNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnLanguageChangeNotification(const MessageSharedPtr& message);
+ OnLanguageChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnLanguageChangeNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h
index 3cffe8ff49..d5f7aa96b8 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h
@@ -51,7 +51,8 @@ class OnPermissionsChangeNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnPermissionsChangeNotification(const MessageSharedPtr& message);
+ OnPermissionsChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnPermissionsChangeNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
index 0763e680a8..143b076033 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
@@ -53,7 +53,8 @@ class OnSystemRequestNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnSystemRequestNotification(const MessageSharedPtr& message);
+ OnSystemRequestNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnSystemRequestNotification class destructor
@@ -72,7 +73,7 @@ class OnSystemRequestNotification : public CommandNotificationImpl {
* @param message Message
*/
void AddHeader(BinaryMessage& message) const;
- void ParsePTString(std::string& pt_string) const;
+ size_t ParsePTString(std::string& pt_string) const;
#endif
DISALLOW_COPY_AND_ASSIGN(OnSystemRequestNotification);
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h
index 5c34caba36..e7b895dceb 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h
@@ -51,7 +51,8 @@ class OnTBTClientStateNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnTBTClientStateNotification(const MessageSharedPtr& message);
+ OnTBTClientStateNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTBTClientStateNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h
index 1aba3087dd..abbf6787db 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h
@@ -53,7 +53,8 @@ class OnTouchEventNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnTouchEventNotification(const MessageSharedPtr& message);
+ OnTouchEventNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnTouchEventNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h
index 7e64f19639..de6172de64 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h
@@ -53,7 +53,8 @@ class OnVehicleDataNotification : public CommandNotificationImpl {
*
* @param message Incoming SmartObject message
**/
- explicit OnVehicleDataNotification(const MessageSharedPtr& message);
+ OnVehicleDataNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief OnVehicleDataNotification class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h
new file mode 100644
index 0000000000..c204e1669c
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h
@@ -0,0 +1,69 @@
+/*
+ * 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_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_H_
+
+#include "application_manager/commands/command_notification_impl.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class OnWayPointChangeNotification : public CommandNotificationImpl {
+ public:
+ /**
+ * @brief OnWayPointChangeNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnWayPointChangeNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief OnWayPointChangeNotification class destructor
+ **/
+ virtual ~OnWayPointChangeNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnWayPointChangeNotification);
+};
+
+} // namespace commands
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_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..b69cb969e1 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
@@ -52,7 +52,8 @@ class PerformAudioPassThruRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit PerformAudioPassThruRequest(const MessageSharedPtr& message);
+ PerformAudioPassThruRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PerformAudioPassThruRequest class destructor
@@ -114,12 +115,19 @@ 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
*/
void FinishTTSSpeak();
- //flag display state of speak during perform audio pass thru
+ // flag display state of speak during perform audio pass thru
bool is_active_tts_speak_;
mobile_apis::Result::eType result_tts_speak_;
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h
index d659e59be0..d227c4fef3 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h
@@ -51,7 +51,8 @@ class PerformAudioPassThruResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit PerformAudioPassThruResponse(const MessageSharedPtr& message);
+ PerformAudioPassThruResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PerformAudioPassThruResponse class destructor
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..f64b2ab334 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 {
@@ -48,15 +47,15 @@ namespace commands {
/**
* @brief PerformInteractionRequest command class
**/
-class PerformInteractionRequest : public CommandRequestImpl {
-
+class PerformInteractionRequest : public CommandRequestImpl {
public:
/**
* @brief PerformInteractionRequest class constructor
*
* @param message Incoming SmartObject message
**/
- explicit PerformInteractionRequest(const MessageSharedPtr& message);
+ PerformInteractionRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PerformInteractionRequest class destructor
@@ -86,7 +85,7 @@ class PerformInteractionRequest : public CommandRequestImpl {
* has exceed it's limit
*
*/
- virtual void onTimeOut();
+ virtual void onTimeOut();
/*
* @brief Function will be called when VR_OnCommand event
@@ -95,7 +94,8 @@ 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
@@ -103,9 +103,9 @@ class PerformInteractionRequest : public CommandRequestImpl {
* @param message which should send to mobile side
*
*/
- void ProcessPerformInteractionResponse
- (const smart_objects::SmartObject& message);
-
+ void ProcessPerformInteractionResponse(
+ const smart_objects::SmartObject& message,
+ smart_objects::SmartObject& msg_params);
/*
* @brief Sends UI PerformInteraction request to HMI
@@ -132,12 +132,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.
*
@@ -146,7 +140,8 @@ class PerformInteractionRequest : public CommandRequestImpl {
* return Return TRUE if there are no similar menu names in choice set,
* otherwise FALSE
*/
- bool CheckChoiceSetMenuNames(application_manager::ApplicationSharedPtr const app);
+ bool CheckChoiceSetMenuNames(
+ application_manager::ApplicationSharedPtr const app);
/*
* @brief Checks if incoming choice set doesn't has similar VR synonyms.
@@ -156,7 +151,8 @@ class PerformInteractionRequest : public CommandRequestImpl {
* return Return TRUE if there are no similar VR synonyms in choice set,
* otherwise FALSE
*/
- bool CheckChoiceSetVRSynonyms(application_manager::ApplicationSharedPtr const app);
+ bool CheckChoiceSetVRSynonyms(
+ application_manager::ApplicationSharedPtr const app);
/*
* @brief Checks if request with non-sequential positions of vrHelpItems
@@ -167,7 +163,8 @@ class PerformInteractionRequest : public CommandRequestImpl {
* @return TRUE if vrHelpItems positions are sequential,
* otherwise FALSE
*/
- bool CheckVrHelpItemPositions(application_manager::ApplicationSharedPtr const app);
+ bool CheckVrHelpItemPositions(
+ application_manager::ApplicationSharedPtr const app);
/*
* @brief Disable PerformInteraction state in application and
@@ -197,13 +194,50 @@ 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 app_pi_was_active_before_;
- static uint32_t pi_requests_count_;
+ 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/perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h
index 4ecc149fb4..1274996747 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h
@@ -51,7 +51,8 @@ class PerformInteractionResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit PerformInteractionResponse(const MessageSharedPtr& message);
+ PerformInteractionResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PerformInteractionResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h
index 8a94a708a1..e3af8ac69b 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
@@ -52,7 +52,8 @@ class PutFileRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit PutFileRequest(const MessageSharedPtr& message);
+ PutFileRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PutFileRequest class destructor
@@ -65,13 +66,13 @@ class PutFileRequest : public CommandRequestImpl {
virtual void Run();
private:
- int64_t offset_;
- std::string sync_file_name_;
- int64_t length_;
- mobile_apis::FileType::eType file_type_;
- bool is_persistent_file_;
+ int64_t offset_;
+ std::string sync_file_name_;
+ int64_t length_;
+ mobile_apis::FileType::eType file_type_;
+ bool is_persistent_file_;
- void SendOnPutFileNotification();
+ void SendOnPutFileNotification();
DISALLOW_COPY_AND_ASSIGN(PutFileRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h
index 89ff6ad08f..f561f9fdbc 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h
@@ -51,7 +51,8 @@ class PutFileResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit PutFileResponse(const MessageSharedPtr& message);
+ PutFileResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief PutFileResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h
index e2e5dbf3da..c88f16dab0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h
@@ -51,7 +51,8 @@ class ReadDIDRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ReadDIDRequest(const MessageSharedPtr& message);
+ ReadDIDRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ReadDIDRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h
index 80b9b5ea48..2e493fa0ec 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h
@@ -51,7 +51,8 @@ class ReadDIDResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ReadDIDResponse(const MessageSharedPtr& message);
+ ReadDIDResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ReadDIDResponse class destructor
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..dc7f9fb755 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
@@ -34,9 +34,10 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_
-#include <string.h>
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/policies/policy_handler_interface.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
**/
@@ -56,7 +59,8 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
/**
* \brief RegisterAppInterfaceRequest class constructor
**/
- explicit RegisterAppInterfaceRequest(const MessageSharedPtr& message);
+ RegisterAppInterfaceRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief RegisterAppInterfaceRequest class destructor
@@ -79,10 +83,21 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
*@param application_impl application
*
**/
- void SendRegisterAppInterfaceResponseToMobile(
- mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS);
+ void SendRegisterAppInterfaceResponseToMobile();
private:
+ smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification(
+ const uint32_t connection_key, ApplicationSharedPtr app);
+
+ /**
+ * @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 +115,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()));
- };
+ 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 +167,11 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
*/
void SendSubscribeCustomButtonNotification();
-private:
+ private:
std::string response_info_;
mobile_apis::Result::eType result_checking_app_hmi_type_;
-
+ policy::PolicyHandlerInterface& GetPolicyHandler();
DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h
index 1244cb65f8..b125cc7c55 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h
@@ -47,15 +47,14 @@ class RegisterAppInterfaceResponse : public CommandResponseImpl {
/**
* \brief RegisterAppInterfaceResponse class constructor
**/
- explicit RegisterAppInterfaceResponse(const MessageSharedPtr& response)
- : CommandResponseImpl(response) {
- }
+ RegisterAppInterfaceResponse(const MessageSharedPtr& response,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(response, application_manager) {}
/**
* \brief RegisterAppInterfaceResponse class destructor
**/
- virtual ~RegisterAppInterfaceResponse() {
- }
+ virtual ~RegisterAppInterfaceResponse() {}
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
index d7abe38c11..0053c14f3c 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
@@ -52,7 +52,8 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ResetGlobalPropertiesRequest(const MessageSharedPtr& message);
+ ResetGlobalPropertiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ResetGlobalPropertiesRequest class destructor
@@ -103,7 +104,8 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl {
*
* @return TRUE on success, otherwise FALSE
*/
- bool ResetVrHelpTitleItems(application_manager::ApplicationSharedPtr const app);
+ bool ResetVrHelpTitleItems(
+ application_manager::ApplicationSharedPtr const app);
/*
* @brief Check if there some not delivered hmi responses exist
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h
index 7c0b8eb00b..39e28486d4 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h
@@ -51,7 +51,8 @@ class ResetGlobalPropertiesResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ResetGlobalPropertiesResponse(const MessageSharedPtr& message);
+ ResetGlobalPropertiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ResetGlobalPropertiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h
index a810f4eb2d..b3058c9a26 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h
@@ -50,7 +50,8 @@ class ScrollableMessageRequest : public CommandRequestImpl {
/**
* @brief ScrollableMessageRequest class constructor
**/
- explicit ScrollableMessageRequest(const MessageSharedPtr& message);
+ ScrollableMessageRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SliderCommand class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h
index f0c0ea8f7a..aa0ac01e9d 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h
@@ -45,13 +45,13 @@ class ScrollableMessageResponse : public CommandResponseImpl {
/**
* \brief ScrollableMessageResponse class constructor
**/
- explicit ScrollableMessageResponse(const MessageSharedPtr& message);
+ ScrollableMessageResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SpeakResponseCommand class destructor
**/
- virtual ~ScrollableMessageResponse() {
- }
+ virtual ~ScrollableMessageResponse() {}
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h
index 581c779aa5..570e70d007 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h
@@ -34,6 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_
+#include <list>
#include "application_manager/commands/command_request_impl.h"
namespace application_manager {
@@ -48,7 +49,8 @@ class SendLocationRequest : public CommandRequestImpl {
/**
* @brief SendLocationRquest class constructor
*/
- explicit SendLocationRequest(const MessageSharedPtr& message);
+ SendLocationRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SendLocationRquest class destructor
@@ -67,8 +69,13 @@ class SendLocationRequest : public CommandRequestImpl {
*/
virtual void on_event(const event_engine::Event& event);
-
private:
+ /**
+ * @brief CheckFieldsCompatibility checks if fields are compatible with each
+ * other.
+ * @return true if compatible, otherwise return false
+ */
+ bool CheckFieldsCompatibility();
/**
* @brief Checks sendlocation params(locationName, locationDescription, ...).
@@ -77,7 +84,8 @@ class SendLocationRequest : public CommandRequestImpl {
*/
bool IsWhiteSpaceExist();
- bool CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names);
+ bool CheckHMICapabilities(
+ std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names);
DISALLOW_COPY_AND_ASSIGN(SendLocationRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h
index fe88a2af29..0be0be8ca3 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h
@@ -36,7 +36,6 @@
#include "application_manager/commands/command_response_impl.h"
#include "application_manager/message.h"
-
namespace application_manager {
namespace commands {
@@ -45,7 +44,8 @@ class SendLocationResponse : public CommandResponseImpl {
/**
* @brief SendLocationResponse class constructor
*/
- explicit SendLocationResponse(const MessageSharedPtr& message);
+ SendLocationResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SendLocationResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h
index da21decd81..42eedad19b 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h
@@ -49,17 +49,15 @@ class SetAppIconRequest : public CommandRequestImpl {
/**
* @brief Contains information about the type of image
*/
- typedef enum {
- STATIC = 0,
- DYNAMIC
- } ImageType;
+ typedef enum { STATIC = 0, DYNAMIC } ImageType;
/**
* @brief SetIconRequest class constructor
*
* @param message Incoming SmartObject message
**/
- explicit SetAppIconRequest(const MessageSharedPtr& message);
+ SetAppIconRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetIconRequest class destructor
@@ -101,11 +99,11 @@ class SetAppIconRequest : public CommandRequestImpl {
bool IsEnoughSpaceForIcon(const uint64_t icon_size) const;
DISALLOW_COPY_AND_ASSIGN(SetAppIconRequest);
-private:
+ private:
/**
* @brief Checks, if icons saving to configured folder is enabled
*/
- static int8_t is_icons_saving_enabled_;
+ bool is_icons_saving_enabled_;
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h
index 02be7fe37e..6061cf5702 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h
@@ -51,7 +51,8 @@ class SetAppIconResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetAppIconResponse(const MessageSharedPtr& message);
+ SetAppIconResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetIconResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h
index 925a1cd67f..06e8d70f79 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h
@@ -51,7 +51,8 @@ class SetDisplayLayoutRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetDisplayLayoutRequest(const MessageSharedPtr& message);
+ SetDisplayLayoutRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetDisplayLayoutRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h
index dbf3de8d88..a2040307b0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h
@@ -51,7 +51,8 @@ class SetDisplayLayoutResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetDisplayLayoutResponse(const MessageSharedPtr& message);
+ SetDisplayLayoutResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetDisplayLayoutResponse class destructor
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..aa26a70393 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 {
@@ -51,7 +51,8 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetGlobalPropertiesRequest(const MessageSharedPtr& message);
+ SetGlobalPropertiesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetGlobalPropertiesRequest class destructor
@@ -71,21 +72,42 @@ 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 +125,6 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl {
*/
bool IsWhiteSpaceExist();
- DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest);
-
bool is_ui_send_;
bool is_tts_send_;
@@ -113,6 +133,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/set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h
index dd80e738e3..c5beda084d 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h
@@ -51,7 +51,8 @@ class SetGlobalPropertiesResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetGlobalPropertiesResponse(const MessageSharedPtr& message);
+ SetGlobalPropertiesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetGlobalPropertiesResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h
index d46094032a..96d4ac6f1e 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/application_manager.h"
#include "utils/macro.h"
namespace application_manager {
@@ -49,17 +50,15 @@ class SetIconRequest : public CommandRequestImpl {
/**
* @brief Contains information about the type of image
*/
- typedef enum {
- STATIC = 0,
- DYNAMIC
- } ImageType;
+ typedef enum { STATIC = 0, DYNAMIC } ImageType;
/**
* @brief SetIconRequest class constructor
*
* @param message Incoming SmartObject message
**/
- explicit SetIconRequest(const MessageSharedPtr& message);
+ SetIconRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SetIconRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h
index 88dceaf5a2..83be0d4a4b 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
+#include "application_manager/application_manager.h"
#include "utils/macro.h"
namespace application_manager {
@@ -51,7 +52,7 @@ class SetIconResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SetIconResponse(const MessageSharedPtr& message);
+ SetIconResponse(const MessageSharedPtr& message, ApplicationManager& app_man);
/**
* @brief SetIconResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h
index e4fae5c0b3..283dd41622 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h
@@ -49,7 +49,8 @@ class SetMediaClockRequest : public CommandRequestImpl {
/**
* \brief SetMediaClockRequest class constructor
**/
- explicit SetMediaClockRequest(const MessageSharedPtr& message);
+ SetMediaClockRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief ShowCommand class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h
index 46844bd2f3..3f41ae2dab 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h
@@ -45,7 +45,8 @@ class SetMediaClockTimerResponse : public CommandResponseImpl {
/**
* \brief SetMediaClockTimerResponse class constructor
**/
- explicit SetMediaClockTimerResponse(const MessageSharedPtr& message);
+ SetMediaClockTimerResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SetMediaClockTimerResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h
index a22ee9852a..f015d740df 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h
@@ -52,7 +52,8 @@ class ShowConstantTBTRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ShowConstantTBTRequest(const MessageSharedPtr& message);
+ ShowConstantTBTRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ShowConstantTBTRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h
index 6a102b1984..73aad5de89 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h
@@ -51,7 +51,8 @@ class ShowConstantTBTResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit ShowConstantTBTResponse(const MessageSharedPtr& message);
+ ShowConstantTBTResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief ShowConstantTBTResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
index 091cab3bfd..cbe2ca396a 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
@@ -50,7 +50,8 @@ class ShowRequest : public CommandRequestImpl {
/**
* \brief ShowRequest class constructor
**/
- explicit ShowRequest(const MessageSharedPtr& message);
+ ShowRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief ShowRequest class destructor
@@ -70,7 +71,6 @@ class ShowRequest : public CommandRequestImpl {
virtual void on_event(const event_engine::Event& event);
private:
-
/*
* @brief Check if all strings have valid syntax in request
*
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h
index c327bc3b3a..0a54fb9cde 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h
@@ -45,7 +45,8 @@ class ShowResponse : public CommandResponseImpl {
/**
* \brief ShowResponse class constructor
**/
- explicit ShowResponse(const MessageSharedPtr& message);
+ ShowResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief ShowResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h
index de24438ddd..2446c9ff20 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h
@@ -49,7 +49,8 @@ class SliderRequest : public CommandRequestImpl {
/**
* \brief SliderRequest class constructor
**/
- explicit SliderRequest(const MessageSharedPtr& message);
+ SliderRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SliderRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h
index 1888388e7c..bc0efaadd0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h
@@ -45,7 +45,8 @@ class SliderResponse : public CommandResponseImpl {
/**
* \brief SliderResponse class constructor
**/
- explicit SliderResponse(const MessageSharedPtr& message);
+ SliderResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SpeakResponseCommand class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h
index 7d3b2096af..dc22652b27 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h
@@ -49,7 +49,8 @@ class SpeakRequest : public CommandRequestImpl {
/**
* \brief SpeakRequest class constructor
**/
- explicit SpeakRequest(const MessageSharedPtr& message);
+ SpeakRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SpeakRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h
index cbf1ec40de..2808526603 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h
@@ -45,7 +45,8 @@ class SpeakResponse : public CommandResponseImpl {
/**
* \brief SpeakResponse class constructor
**/
- explicit SpeakResponse(const MessageSharedPtr& message);
+ SpeakResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* \brief SpeakResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h
index 12168e2473..b5a22d40a9 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h
@@ -52,7 +52,8 @@ class SubscribeButtonRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SubscribeButtonRequest(const MessageSharedPtr& message);
+ SubscribeButtonRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SubscribeButtonRequest class destructor
@@ -65,7 +66,6 @@ class SubscribeButtonRequest : public CommandRequestImpl {
virtual void Run();
private:
-
/**
* @brief Checks if button subscription allowed. In case non-media
* application trying to subscribe on buttons(tune, seek) negative result will
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h
index 8366884540..38e0dd2dc6 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h
@@ -51,7 +51,8 @@ class SubscribeButtonResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SubscribeButtonResponse(const MessageSharedPtr& message);
+ SubscribeButtonResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SubscribeButtonResponse class destructor
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..6b2c2bb616 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 {
@@ -51,7 +52,8 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SubscribeVehicleDataRequest(const MessageSharedPtr& message);
+ SubscribeVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SubscribeButtonCommandRequest class destructor
@@ -82,12 +84,45 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
typedef std::vector<HmiRequest> HmiRequests;
HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
+#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/subscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h
index d2771c0712..7e3cffc387 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h
@@ -51,7 +51,8 @@ class SubscribeVehicleDataResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SubscribeVehicleDataResponse(const MessageSharedPtr& message);
+ SubscribeVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UnsubscribeVehicleDataCommandRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h
new file mode 100644
index 0000000000..50b3a6f2cb
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h
@@ -0,0 +1,77 @@
+/*
+ * 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_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief SubsribeWayPointsRequest command class
+ **/
+class SubscribeWayPointsRequest : public CommandRequestImpl {
+ public:
+ /**
+ * \brief SubscribeWayPointsRequest class constructor
+ **/
+ SubscribeWayPointsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * \brief SubscribeWayPointsRequest class destructor
+ **/
+ virtual ~SubscribeWayPointsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest);
+};
+
+} // commands
+
+} // application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h
new file mode 100644
index 0000000000..cfdc0eede7
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h
@@ -0,0 +1,72 @@
+/*
+ * 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_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief SubscribeWayPointsResponse command class
+ **/
+class SubscribeWayPointsResponse : public CommandResponseImpl {
+ public:
+ /**
+ * \brief SubscribeWayPointsResponse class constructor
+ **/
+ SubscribeWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * \brief SubscribeWayPointsResponse class destructor
+ **/
+ virtual ~SubscribeWayPointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsResponse);
+};
+
+} // commands
+
+} // application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h
index 25accb1db2..de87512e92 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h
@@ -36,6 +36,9 @@
#include <string>
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/event_engine/event.h"
+#include "smart_objects/smart_object.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -57,7 +60,8 @@ class SystemRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SystemRequest(const MessageSharedPtr& message);
+ SystemRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SystemRequest class destructor
@@ -76,17 +80,17 @@ class SystemRequest : public CommandRequestImpl {
*/
virtual void on_event(const event_engine::Event& event);
-private:
+ private:
/**
* @brief Validates data coming within QueryApps response
* @param data Data
* @return true, if data is valid, otherwise - false
*/
- bool ValidateQueryAppData(const smart_objects::SmartObject& data) const;
+ bool ValidateQueryAppData(smart_objects::SmartObject& data) const;
private:
static uint32_t index;
- std::string processing_file_;
+ std::string processing_file_;
DISALLOW_COPY_AND_ASSIGN(SystemRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h
index ca2fb99970..3f48db7f0e 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h
@@ -36,7 +36,6 @@
#include "application_manager/commands/command_response_impl.h"
-
namespace application_manager {
namespace commands {
@@ -51,7 +50,8 @@ class SystemResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit SystemResponse(const MessageSharedPtr& message);
+ SystemResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief SystemResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h
index a5a53736e2..acc7374e18 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h
@@ -49,15 +49,14 @@ class UnregisterAppInterfaceRequest : public CommandRequestImpl {
/**
* \brief UnregisterAppInterfaceRequest class constructor
**/
- explicit UnregisterAppInterfaceRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
- }
+ UnregisterAppInterfaceRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
/**
* \brief UnregisterAppInterfaceRequest class destructor
**/
- virtual ~UnregisterAppInterfaceRequest() {
- }
+ virtual ~UnregisterAppInterfaceRequest() {}
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h
index 5c8928a6c8..1a459e109c 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h
@@ -47,15 +47,14 @@ class UnregisterAppInterfaceResponse : public CommandResponseImpl {
/**
* \brief UnregisterAppInterfaceResponse class constructor
**/
- explicit UnregisterAppInterfaceResponse(const MessageSharedPtr& response)
- : CommandResponseImpl(response) {
- }
+ UnregisterAppInterfaceResponse(const MessageSharedPtr& response,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(response, application_manager) {}
/**
* \brief UnregisterAppInterfaceResponse class destructor
**/
- virtual ~UnregisterAppInterfaceResponse() {
- }
+ virtual ~UnregisterAppInterfaceResponse() {}
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h
index 58c9dc8de9..62600d51d7 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h
@@ -51,7 +51,8 @@ class UnsubscribeButtonRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UnsubscribeButtonRequest(const MessageSharedPtr& message);
+ UnsubscribeButtonRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UnsubscribeButtonRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h
index 972da48065..06dbe84578 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h
@@ -51,7 +51,8 @@ class UnsubscribeButtonResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UnsubscribeButtonResponse(const MessageSharedPtr& message);
+ UnsubscribeButtonResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UnsubscribeButtonResponse class destructor
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..a6bade2fd6 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 {
@@ -51,7 +52,8 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UnsubscribeVehicleDataRequest(const MessageSharedPtr& message);
+ UnsubscribeVehicleDataRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UnsubscribeVehicleDataRequest class destructor
@@ -82,11 +84,40 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl {
typedef std::vector<HmiRequest> HmiRequests;
HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
+#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/commands/mobile/unsubscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h
index 3fb932ecf3..a34a36688c 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h
@@ -51,7 +51,8 @@ class UnsubscribeVehicleDataResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UnsubscribeVehicleDataResponse(const MessageSharedPtr& message);
+ UnsubscribeVehicleDataResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UnsubscribeVehicleDataResponse class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h
new file mode 100644
index 0000000000..2831551667
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h
@@ -0,0 +1,74 @@
+/*
+ * 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_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class UnSubscribeWayPointsRequest : public CommandRequestImpl {
+ public:
+ /**
+ * \brief UnSubscribeWayPointsRequest class constructor
+ **/
+ UnSubscribeWayPointsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * \brief UnSubscribeWayPointsRequest class destructor
+ **/
+ virtual ~UnSubscribeWayPointsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnSubscribeWayPointsRequest);
+};
+
+} // commands
+
+} // application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h
new file mode 100644
index 0000000000..70211330a9
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h
@@ -0,0 +1,72 @@
+/*
+ * 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_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief UnsubscribeWayPointsResponse command class
+ **/
+class UnsubscribeWayPointsResponse : public CommandResponseImpl {
+ public:
+ /**
+ * \brief UnsubscribeWayPointsResponse class constructor
+ **/
+ UnsubscribeWayPointsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * \brief UnsubscribeWayPointsResponse class destructor
+ **/
+ virtual ~UnsubscribeWayPointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsResponse);
+};
+
+} // commands
+
+} // application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h
index c65c2bc534..e15e81caf5 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h
@@ -52,7 +52,8 @@ class UpdateTurnListRequest : public CommandRequestImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateTurnListRequest(const MessageSharedPtr& message);
+ UpdateTurnListRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateTurnListRequest class destructor
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h
index fdbf64826c..481ad9f219 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h
@@ -51,7 +51,8 @@ class UpdateTurnListResponse : public CommandResponseImpl {
*
* @param message Incoming SmartObject message
**/
- explicit UpdateTurnListResponse(const MessageSharedPtr& message);
+ UpdateTurnListResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
/**
* @brief UpdateTurnListResponse class destructor
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..4b8a4088bf 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
@@ -41,11 +41,12 @@
namespace application_manager {
namespace event_engine {
+class EventDispatcher;
+
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
class Event {
public:
-
// Typedef for possible Event ID's from mobile_apis functionID enum
typedef hmi_apis::FunctionID::eType EventID;
@@ -65,7 +66,7 @@ class Event {
* @brief Sends synchronously event to all subscribers.
*
*/
- void raise();
+ void raise(EventDispatcher& event_dispatcher);
/*
* @brief Provides event ID
@@ -102,11 +103,9 @@ class Event {
inline int32_t smart_object_type() const;
protected:
-
private:
-
- EventID id_;
- smart_objects::SmartObject response_so_;
+ EventID id_;
+ smart_objects::SmartObject response_so_;
/*
* @brief Default constructor
@@ -127,21 +126,24 @@ const smart_objects::SmartObject& Event::smart_object() const {
}
int32_t Event::smart_object_function_id() const {
- return response_so_.getElement(
- strings::params).getElement(strings::function_id).asInt();
+ return response_so_.getElement(strings::params)
+ .getElement(strings::function_id)
+ .asInt();
}
int32_t Event::smart_object_correlation_id() const {
- return response_so_.getElement(
- strings::params).getElement(strings::correlation_id).asInt();
+ return response_so_.getElement(strings::params)
+ .getElement(strings::correlation_id)
+ .asInt();
}
int32_t Event::smart_object_type() const {
- return response_so_.getElement(
- strings::params).getElement(strings::message_type).asInt();
+ return response_so_.getElement(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..3d236b9c0f 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,15 +41,14 @@ namespace event_engine {
class EventObserver;
-class EventDispatcher : public utils::Singleton<EventDispatcher> {
+class EventDispatcher {
public:
-
/*
* @brief Delivers the event to all subscribers
*
* @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 +57,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,
- int32_t hmi_correlation_id,
- EventObserver* const observer);
+ virtual void add_observer(const Event::EventID& event_id,
+ int32_t hmi_correlation_id,
+ EventObserver& observer) = 0;
/*
* @brief Unsubscribes the observer from specific event
@@ -73,55 +67,23 @@ 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& 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& 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..9a13ad608b
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
@@ -0,0 +1,129 @@
+/*
+ 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 "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:
+ // Data types section
+ typedef std::vector<EventObserver*> ObserverVector;
+ typedef std::map<int32_t, ObserverVector> ObserversMap;
+ typedef std::map<Event::EventID, ObserversMap> EventObserverMap;
+ /*
+ * @brief Destructor
+ */
+ virtual ~EventDispatcherImpl();
+
+ /*
+ * @brief Default constructor
+ */
+ EventDispatcherImpl();
+
+#ifdef BUILD_TESTS
+ EventObserverMap get_observers() const {
+ return observers_event_;
+ }
+ ObserverVector get_observers_list() const {
+ return observers_;
+ }
+#endif // BUILD_TESTS
+
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ void raise_event(const Event& event) OVERRIDE;
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ void add_observer(const Event::EventID& event_id,
+ int32_t hmi_correlation_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_observer(const Event::EventID& event_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_observer(EventObserver& observer) OVERRIDE;
+
+ private:
+ /*
+ * @brief removes observer
+ * when occurs unsubscribe from event
+ * @param observer to be removed
+ */
+ void remove_observer_from_vector(EventObserver& observer);
+
+ DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl);
+
+ private:
+ // 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..3e910edfa9 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,15 +35,13 @@
#include <string>
#include "application_manager/event_engine/event.h"
-#include "application_manager/event_engine/event_dispatcher.h"
namespace application_manager {
namespace event_engine {
-class EventObserver
-{
+class EventDispatcher;
+class EventObserver {
public:
-
friend class EventDispatcher;
// Typedef for possible Observer ID's from mobile_apis functionID enum
@@ -53,7 +51,7 @@ class EventObserver
* @brief Constructor
*
*/
- EventObserver();
+ EventObserver(EventDispatcher& event_dispatcher);
/*
* @brief Destructor
@@ -75,7 +73,6 @@ class EventObserver
virtual void on_event(const Event& event) = 0;
protected:
-
/*
* @brief Subscribe to an event
*
@@ -83,8 +80,8 @@ class EventObserver
* @param hmi_correlation_id The event HMI correlation ID.
* If param is omitted, it means subscription for HMI notification
*/
- void subscribe_on_event(
- const Event::EventID& event_id, int32_t hmi_correlation_id = 0);
+ void subscribe_on_event(const Event::EventID& event_id,
+ int32_t hmi_correlation_id = 0);
/*
* @brief Unsubscribes the observer from specific event
@@ -100,8 +97,8 @@ class EventObserver
void unsubscribe_from_all_events();
private:
-
ObserverID id_;
+ EventDispatcher& event_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(EventObserver);
};
@@ -110,7 +107,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_
+#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..f94c8125c8 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,28 +37,30 @@
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
#include "utils/macro.h"
+#include "application_manager/hmi_language_handler.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
class SmartObject;
}
}
+namespace resumption {
+class LastState;
+}
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
namespace application_manager {
-class ApplicationManagerImpl;
+class ApplicationManager;
class HMICapabilities {
-
public:
-
/*
* @ Class constructor
*
* @param app_mngr Application manager pointer
*/
- explicit HMICapabilities(ApplicationManagerImpl* const app_mngr);
+ explicit HMICapabilities(ApplicationManager& app_mngr);
/*
* @brief Class destructor
@@ -121,8 +123,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
@@ -136,8 +137,7 @@ class HMICapabilities {
*
* @return Currently supported UI languages
*/
- inline const smart_objects::SmartObject*
- ui_supported_languages() const;
+ inline const smart_objects::SmartObject* ui_supported_languages() const;
/*
* @brief Sets supported UI languages
@@ -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
@@ -167,8 +166,7 @@ class HMICapabilities {
*
* @return Currently supported VR languages
*/
- inline const smart_objects::SmartObject*
- vr_supported_languages() const;
+ inline const smart_objects::SmartObject* vr_supported_languages() const;
/*
* @brief Sets supported VR languages
@@ -183,8 +181,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
@@ -192,15 +189,14 @@ class HMICapabilities {
* @param language Currently active TTS language
*/
void set_active_tts_language(
- const hmi_apis::Common_Language::eType& language);
+ const hmi_apis::Common_Language::eType& language);
/*
* @brief Retrieves TTS supported languages
*
* @return Currently supported TTS languages
*/
- inline const smart_objects::SmartObject*
- tts_supported_languages() const;
+ inline const smart_objects::SmartObject* tts_supported_languages() const;
/*
* @brief Sets supported TTS languages
@@ -215,8 +211,7 @@ class HMICapabilities {
*
* @return Currently supported display capabilities
*/
- inline const smart_objects::SmartObject*
- display_capabilities() const;
+ inline const smart_objects::SmartObject* display_capabilities() const;
/*
* @brief Sets supported display capabilities
@@ -231,8 +226,7 @@ class HMICapabilities {
*
* @return Currently supported HMI zone capabilities
*/
- inline const smart_objects::SmartObject*
- hmi_zone_capabilities() const;
+ inline const smart_objects::SmartObject* hmi_zone_capabilities() const;
/*
* @brief Sets supported HMI zone capabilities
@@ -247,8 +241,7 @@ class HMICapabilities {
*
* @return Currently supported SoftButton's capabilities
*/
- inline const smart_objects::SmartObject*
- soft_button_capabilities() const;
+ inline const smart_objects::SmartObject* soft_button_capabilities() const;
/*
* @brief Sets supported SoftButton's capabilities
@@ -311,12 +304,26 @@ class HMICapabilities {
const smart_objects::SmartObject& audio_pass_thru_capabilities);
/*
+ * @brief Sets supported pcm_stream capabilities
+ *
+ * @param supported pcm stream capabilities
+ */
+ void set_pcm_stream_capabilities(
+ const smart_objects::SmartObject& pcm_stream_capabilities);
+
+ /*
* @brief Retrieves information about the audio_pass_thru capabilities
*
* @return Currently supported audio_pass_thru capabilities
*/
- inline const smart_objects::SmartObject*
- audio_pass_thru_capabilities() const;
+ inline const smart_objects::SmartObject* audio_pass_thru_capabilities() const;
+
+ /*
+ * @brief Retrieves information about the pcm_stream capabilities
+ *
+ * @return Currently supported pcm_streaming capabilities
+ */
+ inline const smart_objects::SmartObject* pcm_stream_capabilities() const;
/*
* @brief Retrieves information about the preset bank capabilities
@@ -360,7 +367,7 @@ class HMICapabilities {
* @param prerecorded_speech supported prerecorded speech
*/
void set_prerecorded_speech(
- const smart_objects::SmartObject& prerecorded_speech);
+ const smart_objects::SmartObject& prerecorded_speech);
/*
* @brief Interface used to store information if navigation
@@ -393,7 +400,8 @@ class HMICapabilities {
inline bool phone_call_supported() const;
/*
- * @brief Interface used to store information about software version of the target
+ * @brief Interface used to store information about software version of the
+ *target
*
* @param ccpu_version Received system/hmi software version
*/
@@ -406,8 +414,18 @@ class HMICapabilities {
*/
inline const std::string& ccpu_version() const;
- protected:
+ void Init(resumption::LastState* last_state);
+ /**
+ * @brief return component which follows for correctness of
+ * languages
+ * @return HMI language handler
+ */
+ HMILanguageHandler& get_hmi_language_handler() {
+ return hmi_language_handler_;
+ }
+
+ protected:
/*
* @brief Loads capabilities from local file in case SDL was launched
* without HMI
@@ -426,8 +444,8 @@ class HMICapabilities {
* @returns TRUE if member exists and returns FALSE if
* member does not exist.
*/
- bool check_existing_json_member(
- const Json::Value& json_member, const char* name_of_member);
+ bool check_existing_json_member(const Json::Value& json_member,
+ const char* name_of_member);
/*
* @brief function converts json object "languages" to smart object
@@ -440,41 +458,43 @@ class HMICapabilities {
smart_objects::SmartObject& languages);
private:
- bool is_vr_cooperating_;
- bool is_tts_cooperating_;
- bool is_ui_cooperating_;
- bool is_navi_cooperating_;
- bool is_ivi_cooperating_;
+ bool is_vr_cooperating_;
+ bool is_tts_cooperating_;
+ bool is_ui_cooperating_;
+ bool is_navi_cooperating_;
+ bool is_ivi_cooperating_;
// to check if IsReady response for corresponding interface received
- bool is_vr_ready_response_recieved_;
- bool is_tts_ready_response_recieved_;
- bool is_ui_ready_response_recieved_;
- bool is_navi_ready_response_recieved_;
- bool is_ivi_ready_response_recieved_;
+ bool is_vr_ready_response_recieved_;
+ bool is_tts_ready_response_recieved_;
+ bool is_ui_ready_response_recieved_;
+ bool is_navi_ready_response_recieved_;
+ bool is_ivi_ready_response_recieved_;
- bool attenuated_supported_;
+ bool attenuated_supported_;
hmi_apis::Common_Language::eType ui_language_;
hmi_apis::Common_Language::eType vr_language_;
hmi_apis::Common_Language::eType tts_language_;
- smart_objects::SmartObject* vehicle_type_;
- smart_objects::SmartObject* ui_supported_languages_;
- smart_objects::SmartObject* tts_supported_languages_;
- smart_objects::SmartObject* vr_supported_languages_;
- smart_objects::SmartObject* display_capabilities_;
- smart_objects::SmartObject* hmi_zone_capabilities_;
- smart_objects::SmartObject* soft_buttons_capabilities_;
- smart_objects::SmartObject* button_capabilities_;
- smart_objects::SmartObject* preset_bank_capabilities_;
- smart_objects::SmartObject* vr_capabilities_;
- smart_objects::SmartObject* speech_capabilities_;
- smart_objects::SmartObject* audio_pass_thru_capabilities_;
- smart_objects::SmartObject* prerecorded_speech_;
- bool is_navigation_supported_;
- bool is_phone_call_supported_;
- std::string ccpu_version_;
-
- ApplicationManagerImpl* app_mngr_;
+ smart_objects::SmartObject* vehicle_type_;
+ smart_objects::SmartObject* ui_supported_languages_;
+ smart_objects::SmartObject* tts_supported_languages_;
+ smart_objects::SmartObject* vr_supported_languages_;
+ smart_objects::SmartObject* display_capabilities_;
+ smart_objects::SmartObject* hmi_zone_capabilities_;
+ smart_objects::SmartObject* soft_buttons_capabilities_;
+ smart_objects::SmartObject* button_capabilities_;
+ smart_objects::SmartObject* preset_bank_capabilities_;
+ smart_objects::SmartObject* vr_capabilities_;
+ smart_objects::SmartObject* speech_capabilities_;
+ smart_objects::SmartObject* audio_pass_thru_capabilities_;
+ smart_objects::SmartObject* pcm_stream_capabilities_;
+ smart_objects::SmartObject* prerecorded_speech_;
+ std::string ccpu_version_;
+ bool is_navigation_supported_;
+ bool is_phone_call_supported_;
+
+ ApplicationManager& app_mngr_;
+ HMILanguageHandler hmi_language_handler_;
DISALLOW_COPY_AND_ASSIGN(HMICapabilities);
};
@@ -499,48 +519,33 @@ 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 {
+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 {
+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 {
+const smart_objects::SmartObject* HMICapabilities::tts_supported_languages()
+ const {
return tts_supported_languages_;
}
-const smart_objects::SmartObject*
-HMICapabilities::display_capabilities() const {
+const smart_objects::SmartObject* HMICapabilities::display_capabilities()
+ const {
return display_capabilities_;
}
-const smart_objects::SmartObject*
-HMICapabilities::hmi_zone_capabilities() const {
+const smart_objects::SmartObject* HMICapabilities::hmi_zone_capabilities()
+ const {
return hmi_zone_capabilities_;
}
-const smart_objects::SmartObject*
-HMICapabilities::soft_button_capabilities() const {
+const smart_objects::SmartObject* HMICapabilities::soft_button_capabilities()
+ const {
return soft_buttons_capabilities_;
}
@@ -548,8 +553,7 @@ const smart_objects::SmartObject* HMICapabilities::button_capabilities() const {
return button_capabilities_;
}
-const smart_objects::SmartObject*
-HMICapabilities::speech_capabilities() const {
+const smart_objects::SmartObject* HMICapabilities::speech_capabilities() const {
return speech_capabilities_;
}
@@ -562,8 +566,13 @@ HMICapabilities::audio_pass_thru_capabilities() const {
return audio_pass_thru_capabilities_;
}
-const smart_objects::SmartObject*
-HMICapabilities::preset_bank_capabilities() const {
+const smart_objects::SmartObject* HMICapabilities::pcm_stream_capabilities()
+ const {
+ return pcm_stream_capabilities_;
+}
+
+const smart_objects::SmartObject* HMICapabilities::preset_bank_capabilities()
+ const {
return preset_bank_capabilities_;
}
@@ -575,11 +584,14 @@ const smart_objects::SmartObject* HMICapabilities::vehicle_type() const {
return vehicle_type_;
}
-const smart_objects::SmartObject*
-HMICapabilities::prerecorded_speech() const {
+const smart_objects::SmartObject* 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 +600,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_command_factory.h b/src/components/application_manager/include/application_manager/hmi_command_factory.h
index 89936e4ca6..6603563c6d 100644
--- a/src/components/application_manager/include/application_manager/hmi_command_factory.h
+++ b/src/components/application_manager/include/application_manager/hmi_command_factory.h
@@ -37,9 +37,8 @@
#include "utils/macro.h"
namespace application_manager {
-
typedef utils::SharedPtr<commands::Command> CommandSharedPtr;
-
+class ApplicationManager;
/**
* @brief Factory class for command creation
**/
@@ -51,7 +50,9 @@ class HMICommandFactory {
* @param smartObject SmartObject shared pointer.
* @return Pointer to created command object.
**/
- static CommandSharedPtr CreateCommand(const commands::MessageSharedPtr& message);
+ static CommandSharedPtr CreateCommand(
+ const commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager);
private:
HMICommandFactory();
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..e8af02c189
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h
@@ -0,0 +1,187 @@
+/*
+ * 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 "utils/lock.h"
+#include "interfaces/HMI_API.h"
+namespace resumption {
+class LastState;
+}
+namespace application_manager {
+
+class ApplicationManager;
+/**
+ * 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(ApplicationManager& application_manager);
+
+ /**
+ * @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);
+ void Init(resumption::LastState* value);
+
+ /**
+ * @brief Removes application from container after
+ * removing application from core
+ * @param app_id id application for removing
+ */
+ void OnUnregisterApplication(uint32_t app_id);
+
+ 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_;
+ resumption::LastState* last_state_;
+ ApplicationManager& application_manager_;
+};
+
+} // 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..31da7647fa 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,304 @@
+/*
+ * 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, const ApplicationManager& app_mngr);
+ HmiState(uint32_t app_id,
+ const 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 return 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_;
+ const 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:
+ virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE;
+ VRHmiState(uint32_t app_id, const 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, const ApplicationManager& app_mngr);
+ virtual 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, const 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, const ApplicationManager& app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
};
/**
- * @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, const 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, const ApplicationManager& app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
+
+/**
+ * @brief The AudioSource class implements logic of OnEventChanged(AUDIO_SOURCE)
+ * temporary state
+ */
+class AudioSource : public HmiState {
+ public:
+ AudioSource(uint32_t app_id, const ApplicationManager& app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
+
+/**
+ * @brief The EmbeddedNavi class implements logic of
+ * OnEventChanged(EMBEDDED_NAVI)
+ * temporary state
+ */
+class EmbeddedNavi : public HmiState {
+ public:
+ EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
}
-#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.h b/src/components/application_manager/include/application_manager/message.h
index 5a2c8bdc18..521e0baca5 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -53,7 +53,7 @@ enum MessageType {
kRequest = 0,
kResponse = 1,
kNotification = 2,
- kErrorResponse = 3 // Error Response HMI ONLY
+ kErrorResponse = 3 // Error Response HMI ONLY
};
// Map PrcType to corresponding MessageType
@@ -103,12 +103,14 @@ class Message {
void set_data_size(size_t data_size);
void set_payload_size(size_t payload_size);
- protocol_handler::MessagePriority Priority() const { return priority_; }
+ protocol_handler::MessagePriority Priority() const {
+ return priority_;
+ }
private:
- int32_t function_id_; // @remark protocol V2.
+ int32_t function_id_; // @remark protocol V2.
int32_t correlation_id_; // @remark protocol V2.
- MessageType type_; // @remark protocol V2.
+ MessageType type_; // @remark protocol V2.
// Pre-calculated message priority, higher priority messages are
// Processed first
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..ab89883ad2 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,8 @@
#include "application_manager/application.h"
#include "application_manager/vehicle_info_data.h"
#include "policy/policy_types.h"
+#include "protocol_handler/session_observer.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -50,6 +53,10 @@ class SmartObject;
}
}
+namespace policy {
+class PolicyHandlerInterface;
+}
+
namespace application_manager {
namespace mobile_api = mobile_apis;
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
@@ -66,508 +73,629 @@ 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);
-
- /**
- * @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 Retrieve vehicle data map for param name in mobile request
- * to VehicleDataType
- *
- * @return VehicleData reference
- */
- 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(
+ 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(
+ const uint32_t correlation_id,
+ const std::vector<std::string>& params,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Create mobile HashUpdateNotification
+ */
+ static smart_objects::SmartObjectSPtr CreateHashUpdateNotification(
+ const uint32_t app_id);
+
+ /**
+ * @brief Sends to mobile HashUpdateNotification
+ */
+ static void SendHashUpdateNotification(const uint32_t app_id,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Sends OnLanguageChange notification to application
+ * @param connection_key Connection key of application
+ */
+ static void SendOnLanguageChangeToMobile(uint32_t connection_key);
+
+ /*
+ * @brief Retrieve vehicle data map for param name in mobile request
+ * to VehicleDataType
+ *
+ * @return VehicleData reference
+ */
+ static const VehicleData& vehicle_data();
+
+ /**
+ * @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,
+ const 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 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 SendOnResumeAudioSourceToHMI(const uint32_t app_id);
-
- static std::string GetDeviceMacAddressForHandle(
- const uint32_t device_handle);
-
- static void GetDeviceInfoForHandle(const uint32_t device_handle,
- policy::DeviceParams* device_info);
- static void GetDeviceInfoForApp(uint32_t connection_key,
- policy::DeviceParams* device_info);
-
- /**
- * @brief Send SDL_ActivateApp response to HMI
- * @param permissions response parameters
- */
- static void SendSDLActivateAppResponse(policy::AppPermissions& permissions,
- uint32_t correlation_id);
+ /*
+ * @brief Prepare GetDeviceListResponse
+ *
+ *
+ * @param devices Devices list
+ *
+ */
+ static smart_objects::SmartObjectSPtr CreateDeviceListSO(
+ const connection_handler::DeviceMap& devices,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr);
+
+ static smart_objects::SmartObjectSPtr CreateModuleInfoSO(
+ uint32_t function_id, ApplicationManager& app_mngr);
+
+ 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,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Returns IVI subscription requests
+ */
+ static smart_objects::SmartObjectList GetIVISubscriptionRequests(
+ ApplicationSharedPtr app, ApplicationManager& app_mngr);
+
+ /**
+ * @brief Sends button subscription notification
+ */
+ static void SendOnButtonSubscriptionNotification(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button,
+ const bool is_subscribed,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Sends button subscription notifications for all buttons
+ * that application is subscribed on
+ */
+ static void SendAllOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+
+ static void SendAppDataToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_man);
+ static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id);
+
+ static smart_objects::SmartObjectSPtr CreateAppVrHelp(
+ ApplicationConstSharedPtr app);
- /**
- * @brief Send OnSDLConsentNeeded to HMI for device data consent by user
- * @param device_info Device info, e.g. mac, handle, name
+ static smart_objects::SmartObjectList CreateShowRequestToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id);
+ static void SendShowRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+ static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_man);
+ static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_man);
+ static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+
+ static smart_objects::SmartObjectList
+ CreateAddVRCommandRequestFromChoiceToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Sends UI_ChangeRegistration to HMI with list of AppHMIType
+ * @param app applicaton instace
+ */
+ static void SendUIChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+ static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+ static void SendAddVRCommandToHMI(
+ uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id,
+ ApplicationManager& app_mngr);
+
+ static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI(
+ uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @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,
+ const policy::PolicyHandlerInterface& policy_handler,
+ smart_objects::SmartObject* output,
+ ApplicationManager& app_mngr);
+
+ static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id);
+
+ /*
+ * @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,
+ ApplicationManager& app_mngr);
+
+ static NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr
+ GetBCActivateAppRequestToHMI(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority,
+ ApplicationManager& app_mngr);
+
+ static void SendOnResumeAudioSourceToHMI(const uint32_t app_id,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Send SDL_ActivateApp response to HMI
+ * @param permissions response parameters
+ */
+ static void SendSDLActivateAppResponse(policy::AppPermissions& permissions,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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,
+ ApplicationManager& app_man);
+
+ /**
+ * @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,
+ int timeout,
+ const std::vector<int>& retries,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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(
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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);
-
- static void SendSystemRequestNotification(
- 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(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(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(
- 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(
- 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,
- 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,
- 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(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
- *
- */
- static mobile_apis::Result::eType VerifyImageFiles(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
-
- static mobile_apis::Result::eType VerifyImageVrHelpItems(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
-
- /**
- * @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);
-
- static mobile_apis::Result::eType ProcessSoftButtons(
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @brief Sends notification to HMI to start video streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendNaviStartStream(int32_t app_id, ApplicationManager& app_mngr);
+
+ /*
+ * @brief Sends notification to HMI to stop video streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendNaviStopStream(int32_t app_id, ApplicationManager& app_mngr);
+
+ /*
+ * @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(
+ uint32_t connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url,
+ ApplicationManager& app_mngr);
+
+ static void SendSystemRequestNotification(
+ uint32_t connection_key,
+ NsSmartDeviceLink::NsSmartObjects::SmartObject& content,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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,
+ ApplicationManager& app_man);
+
+ /**
+ * @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,
+ ApplicationManager& app_man);
+
+ /*
+ * @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,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @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,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Send OnStatusUpdate to HMI on policy update status change
+ * @param status Policy table update status
+ */
+ static void SendOnStatusUpdate(const std::string& status,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Send GetSystemInfo request to HMI
+ */
+ static void SendGetSystemInfoRequest(ApplicationManager& app_mngr);
+
+ /*
+ * @brief Sends notification to HMI to start audio streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendAudioStartStream(int32_t app_id,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @brief Sends notification to HMI to stop audio streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendAudioStopStream(int32_t connection_key,
+ ApplicationManager& app_mngr);
+
+ static void SendOnDataStreaming(protocol_handler::ServiceType service,
+ bool available,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @brief Sends notification to HMI to stop audioPathThru
+ *
+ * @param connection_key Application connection key
+ *
+ * @return TRUE on SUCCES otherwise return FALSE
+ */
+ static bool SendStopAudioPathThru(ApplicationManager& app_mngr);
+
+ /**
+ * @brief Sends UnsubscribeWayPoints request
+ * @return true if UnSubscribedWayPoints is send otherwise false
+ */
+ static bool SendUnsubscribedWayPoints(ApplicationManager& app_mngr);
+
+ static smart_objects::SmartObjectSPtr CreateNegativeResponse(
+ uint32_t connection_key,
+ int32_t function_id,
+ const 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,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @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,
+ ApplicationManager& app_mngr);
+
+ static mobile_apis::Result::eType VerifyImageVrHelpItems(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @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);
+
+ static mobile_apis::Result::eType ProcessSoftButtons(
smart_objects::SmartObject& message_params,
- ApplicationConstSharedPtr app);
-
- /**
- * @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);
-
- static bool PrintSmartObject(const smart_objects::SmartObject& object);
-
- template<typename From, typename To>
- static To ConvertEnumAPINoCheck(const From& input) {
- return static_cast<To>(input);
- }
-
- /**
- * @brief Convert common language to string representation
- * @param language Common language
- * @return Common language string representation
- */
- static std::string CommonLanguageToString(
+ ApplicationConstSharedPtr app,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr);
+
+ /*
+ * @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);
+
+ 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 const uint32_t GetPriorityCode(const std::string& priority);
+ /**
+ * @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 Converts string to common language enum value
- * @param language language as string
- * @return Common language enum value
- */
- static hmi_apis::Common_Language::eType CommonLanguageFromString(
- const std::string& language);
-
- /**
- * @brief Gets command limit number per minute for specific application
- * @param policy_app_id Unique application id
- * @return Limit for number of command per minute
- */
- static uint32_t GetAppCommandLimit(const std::string& policy_app_id);
-
- /**
- * @brief Creates TTS.SetGlobalProperties request and sends
- * to HMI for VCA module.
- * @param app contains application which sends TTS GlobalProperties to HMI
- * after timeout or first time when application register with level NONE or
- * BACKGROUND
- * @param default_help_prompt
- * if default_help_prompt=TRUE->TTSGlobalProperties request will be created with
- * default helpPrompt array, otherwise TTSGlobalProperties request will be created
- * with empty helpPrompt array.
- */
- static void SendTTSGlobalProperties(
- ApplicationSharedPtr app, bool default_help_prompt);
-
- /**
- * @brief SendSetAppIcon allows to send SetAppIcon request.
- *
- * @param app_id application for which icon request should be sent.
- *
- * @param icon_path path to the icon.
- */
- static void SendSetAppIcon(uint32_t app_id,
- const std::string& icon_path);
- private:
- /**
- * @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 smart_objects::SmartObjectSPtr CreateChangeRegistration(
- int32_t function_id, int32_t language, uint32_t app_id,
- const smart_objects::SmartObject* app_types = NULL);
-
- MessageHelper();
-
- static const VehicleData vehicle_data_;
- DISALLOW_COPY_AND_ASSIGN(MessageHelper);
+ /**
+ * @brief Converts string to mobile language enum value
+ * @param language language as string
+ * @return Mobile language enum value
+ */
+ static mobile_apis::Language::eType MobileLanguageFromString(
+ const std::string& language);
+
+ /**
+ * @brief Converts mobile language enum to HMI language enum
+ * @param language Mobile language enum
+ * @return HMI language enum
+ */
+ static hmi_apis::Common_Language::eType MobileToCommonLanguage(
+ const mobile_apis::Language::eType language);
+
+ /**
+ * @brief Converts HMI language enum to mobile language enum
+ * @param language HMI language enum
+ * @return Mobile language enum
+ */
+ static mobile_apis::Language::eType CommonToMobileLanguage(
+ const hmi_apis::Common_Language::eType language);
+
+ /**
+ * @brief Gets command limit number per minute for specific application
+ * @param policy_app_id Unique application id
+ * @return Limit for number of command per minute
+ */
+ static uint32_t GetAppCommandLimit(const std::string& policy_app_id);
+
+ /**
+ * @brief Creates TTS.SetGlobalProperties request and sends
+ * to HMI for VCA module.
+ * @param app contains application which sends TTS GlobalProperties to HMI
+ * after timeout or first time when application register with level NONE or
+ * BACKGROUND
+ * @param default_help_prompt
+ * if default_help_prompt=TRUE->TTSGlobalProperties request will be created
+ * with
+ * default helpPrompt array, otherwise TTSGlobalProperties request will be
+ * created
+ * with empty helpPrompt array.
+ */
+ static void SendTTSGlobalProperties(ApplicationSharedPtr app,
+ const bool default_help_prompt,
+ ApplicationManager& app_man);
+
+ /**
+ * @brief SendSetAppIcon allows to send SetAppIcon request.
+ *
+ * @param app_id application for which icon request should be sent.
+ *
+ * @param icon_path path to the icon.
+ */
+ static void SendSetAppIcon(const uint32_t app_id,
+ const std::string& icon_path,
+ ApplicationManager& application_manager);
+
+ static hmi_apis::Common_Language::eType CommonLanguageFromString(
+ const std::string& language);
+
+ static smart_objects::SmartObjectSPtr
+ GetOnAppInterfaceUnregisteredNotificationToMobile(
+ int32_t connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::eType reason);
+
+ private:
+ /**
+ * @brief Creates new request object and fill its header
+ * @return New request object
+ */
+ static smart_objects::SmartObjectSPtr CreateRequestObject(
+ const uint32_t correlation_id);
+
+ /**
+ * @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 smart_objects::SmartObjectSPtr CreateChangeRegistration(
+ const int32_t function_id,
+ const int32_t language,
+ const uint32_t app_id,
+ const smart_objects::SmartObject* app_types,
+ ApplicationManager& app_mngr);
+
+ MessageHelper();
+
+ static const VehicleData vehicle_data_;
+ DISALLOW_COPY_AND_ASSIGN(MessageHelper);
};
} // namespace application_manager
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..1f270b28db 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
@@ -39,6 +39,7 @@
namespace application_manager {
typedef utils::SharedPtr<commands::Command> CommandSharedPtr;
+class ApplicationManager;
/**
* @brief Factory class for command creation
@@ -51,9 +52,10 @@ class MobileCommandFactory {
* @param smartObject SmartObject shared pointer.
* @return Pointer to created command object.
**/
- static commands::Command* CreateCommand(
- const commands::MessageSharedPtr& message,
- commands::Command::CommandOrigin origin);
+ static CommandSharedPtr CreateCommand(
+ const commands::MessageSharedPtr& message,
+ commands::Command::CommandOrigin origin,
+ ApplicationManager& application_manager);
private:
MobileCommandFactory();
diff --git a/src/components/application_manager/include/application_manager/mobile_message_handler.h b/src/components/application_manager/include/application_manager/mobile_message_handler.h
index 5e8d551aee..6b62258b23 100644
--- a/src/components/application_manager/include/application_manager/mobile_message_handler.h
+++ b/src/components/application_manager/include/application_manager/mobile_message_handler.h
@@ -40,29 +40,29 @@
namespace application_manager {
typedef utils::SharedPtr<application_manager::Message> MobileMessage;
class MobileMessageHandler {
- public:
- static application_manager::Message* HandleIncomingMessageProtocol(
+ public:
+ static application_manager::Message* HandleIncomingMessageProtocol(
const protocol_handler::RawMessagePtr message);
- static protocol_handler::RawMessage* HandleOutgoingMessageProtocol(
+ static protocol_handler::RawMessage* HandleOutgoingMessageProtocol(
const MobileMessage& message);
- //! -------------------------------------------------------------
- private:
- static application_manager::Message* HandleIncomingMessageProtocolV1(
+ //! -------------------------------------------------------------
+ private:
+ static application_manager::Message* HandleIncomingMessageProtocolV1(
const protocol_handler::RawMessagePtr message);
- static application_manager::Message* HandleIncomingMessageProtocolV2(
+ static application_manager::Message* HandleIncomingMessageProtocolV2(
const protocol_handler::RawMessagePtr message);
- //! -------------------------------------------------------------
+ //! -------------------------------------------------------------
- static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV1(
+ static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV1(
const MobileMessage& message);
- static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV2(
+ static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV2(
const MobileMessage& message);
- DISALLOW_COPY_AND_ASSIGN(MobileMessageHandler);
+ DISALLOW_COPY_AND_ASSIGN(MobileMessageHandler);
};
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h b/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h
index 55a4f146c2..6913f5038e 100644
--- a/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h
@@ -33,49 +33,50 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
-
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
#include "utils/conditional_variable.h"
#include "policy/policy_types.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace policy {
-
+/**
+*@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
+*in async way.
+*/
+class AppPermissionDelegate : public threads::ThreadDelegate {
+ public:
/**
- * @brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
- * in async way.
- */
-class AppPermissionDelegate: public threads::ThreadDelegate {
- public:
- /**
- * @brief AppPermissionDelegate constructor, contains parameters
- * which will be pass to the called function.
- *
- * @param connection_key connection key.
- *
- * @param permissions new permissions
- */
- AppPermissionDelegate(const uint32_t connection_key,
- const PermissionConsent &permissions);
+ * @brief AppPermissionDelegate constructor, contains parameters
+ * which will be pass to the called function.
+ *
+ * @param connection_key connection key.
+ *
+ * @param permissions new permissions
+ */
+ AppPermissionDelegate(const uint32_t connection_key,
+ const PermissionConsent& permissions,
+ policy::PolicyHandlerInterface& policy_handler);
- /**
- * @brief threadMain run the needed function.
- */
- virtual void threadMain();
-
- /**
- * @brief exitThreadMain do some stuff before exit from thread
- *
- * @return true in case when thread has been finished properly
- */
- virtual void exitThreadMain();
+ /**
+ * @brief threadMain run the needed function.
+ */
+ virtual void threadMain();
- private:
- uint32_t connection_key_;
- PermissionConsent permissions_;
+ /**
+ * @brief exitThreadMain do some stuff before exit from thread
+ *
+ * @return true in case when thread has been finished properly
+ */
+ virtual void exitThreadMain();
+
+ private:
+ uint32_t connection_key_;
+ PermissionConsent permissions_;
+ policy::PolicyHandlerInterface& policy_handler_;
};
-} // namespace policy
+} // namespace policy
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
diff --git a/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h b/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h
index 9044a3fd33..3dc9ad925c 100644
--- a/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h
@@ -42,41 +42,45 @@
namespace policy {
- class StatisticsDelegate: public threads::ThreadDelegate {
- enum StatisticType{
- INCREMENT_GLOBAL,
- INCREMENT_APP,
- SET,
- ADD
- };
- public:
- explicit StatisticsDelegate(usage_statistics::GlobalCounterId type);
-
- StatisticsDelegate(const std::string& app_id,
- usage_statistics::AppCounterId type);
-
- StatisticsDelegate(const std::string& app_id,
- usage_statistics::AppInfoId type,
- const std::string& value);
-
- StatisticsDelegate(const std::string& app_id,
- usage_statistics::AppStopwatchId type,
- int32_t timespan_seconds);
-
- virtual void threadMain();
-
- virtual void exitThreadMain();
- private:
- StatisticType type_;
- usage_statistics::GlobalCounterId global_counter_;
- usage_statistics::AppCounterId app_counter_;
- usage_statistics::AppInfoId app_info_;
- usage_statistics::AppStopwatchId stop_watch_;
-
- std::string app_id_;
- std::string value_;
- int32_t timespan_seconds_;
- };
-} // namespace policy
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_STATISTICS_DELEGATE_H_
+class PolicyHandler;
+
+class StatisticsDelegate : public threads::ThreadDelegate {
+ enum StatisticType { INCREMENT_GLOBAL, INCREMENT_APP, SET, ADD };
+
+ public:
+ StatisticsDelegate(PolicyHandler& policy_handler,
+ usage_statistics::GlobalCounterId type);
+
+ StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
+ usage_statistics::AppCounterId type);
+
+ StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value);
+
+ StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds);
+
+ virtual void threadMain();
+
+ virtual void exitThreadMain();
+
+ private:
+ StatisticType type_;
+ usage_statistics::GlobalCounterId global_counter_;
+ usage_statistics::AppCounterId app_counter_;
+ usage_statistics::AppInfoId app_info_;
+ usage_statistics::AppStopwatchId stop_watch_;
+
+ std::string app_id_;
+ std::string value_;
+ int32_t timespan_seconds_;
+ PolicyHandler& policy_handler_;
+};
+} // namespace policy
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_STATISTICS_DELEGATE_H_
diff --git a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
index e251170fec..13f070a1ec 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
@@ -30,30 +30,34 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_
#include "application_manager/event_engine/event_observer.h"
+#include "utils/lock.h"
namespace policy {
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
-class PolicyHandler;
+class PolicyHandlerInterface;
-class PolicyEventObserver :
- public application_manager::event_engine::EventObserver {
+class PolicyEventObserver
+ : public application_manager::event_engine::EventObserver {
public:
- explicit PolicyEventObserver(policy::PolicyHandler* const policy_handler);
- void set_policy_handler(policy::PolicyHandler* const policy_handler);
+ PolicyEventObserver(
+ policy::PolicyHandlerInterface* const policy_handler,
+ application_manager::event_engine::EventDispatcher& event_dispatcher);
+ void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler);
void on_event(const application_manager::event_engine::Event& event);
void subscribe_on_event(
const application_manager::event_engine::Event::EventID& event_id,
int32_t hmi_correlation_id = 0);
+
private:
sync_primitives::Lock policy_handler_lock_;
- PolicyHandler* policy_handler_;
+ PolicyHandlerInterface* policy_handler_;
void ProcessOdometerEvent(const smart_objects::SmartObject& message);
};
} // namespace policy
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_
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 1fb7d68d25..6f36408444 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
@@ -37,80 +37,93 @@
#include <map>
#include <set>
#include <vector>
-#include <cstdint>
+#include <list>
+#include <stdint.h>
+
#include "policy/policy_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/policy_event_observer.h"
#include "application_manager/policies/delegates/statistics_delegate.h"
+#include "application_manager/policies/policy_handler_observer.h"
#include "utils/logger.h"
-#include "utils/singleton.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
#include "utils/conditional_variable.h"
#include "utils/rwlock.h"
-#include "usage_statistics/statistics_manager.h"
-#include "application_manager/policies/policy_handler_observer.h"
+#include "utils/custom_string.h"
+#include "policy/usage_statistics/statistics_manager.h"
#include "utils/threads/async_runner.h"
-#include "application_manager/application_manager_impl.h"
+#include "policy/policy_settings.h"
namespace Json {
class Value;
}
+namespace application_manager {
+class ApplicationManager;
+}
+
namespace policy {
typedef std::vector<uint32_t> AppIds;
typedef std::vector<uint32_t> DeviceHandles;
-
-class PolicyHandler
- : public utils::Singleton<PolicyHandler,
- utils::deleters::Deleter<PolicyHandler>>,
- public PolicyListener,
- public threads::AsyncRunner {
-public:
+namespace custom_str = utils::custom_string;
+
+class PolicyHandler : public PolicyHandlerInterface,
+ public PolicyListener,
+ public threads::AsyncRunner {
+ public:
+ PolicyHandler(const policy::PolicySettings& get_settings,
+ application_manager::ApplicationManager& application_manager);
virtual ~PolicyHandler();
- bool LoadPolicyLibrary();
- bool PolicyEnabled();
- bool InitPolicyTable();
- bool ResetPolicyTable();
- bool ClearUserConsent();
- bool SendMessageToSDK(const BinaryMessage &pt_string, const std::string &url);
- bool ReceiveMessageFromSDK(const std::string &file,
- const BinaryMessage &pt_string);
- bool UnloadPolicyLibrary();
- virtual void OnPermissionsUpdated(const std::string &policy_app_id,
- const Permissions &permissions,
- const HMILevel &default_hmi);
-
- virtual void OnPermissionsUpdated(const std::string &policy_app_id,
- const Permissions &permissions);
-
- 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);
-
- 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);
- bool GetInitialAppData(const std::string &application_id,
- StringArray *nicknames = NULL,
- StringArray *app_hmi_types = NULL);
- void GetServiceUrls(const std::string &service_type,
- EndpointUrls &end_points);
-
- std::string GetLockScreenIconUrl() const;
- void ResetRetrySequence();
- uint32_t NextRetryTimeout();
- int TimeoutExchange();
- void OnExceededTimeout();
- void OnSystemReady();
- void PTUpdatedAt(int kilometers, int days_after_epoch);
- void add_listener(PolicyHandlerObserver *listener);
- void remove_listener(PolicyHandlerObserver *listener);
-
- utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager();
+ bool LoadPolicyLibrary() OVERRIDE;
+ bool PolicyEnabled() const OVERRIDE;
+ bool InitPolicyTable() OVERRIDE;
+ bool ResetPolicyTable() OVERRIDE;
+ bool ClearUserConsent() OVERRIDE;
+ bool SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url) OVERRIDE;
+ bool ReceiveMessageFromSDK(const std::string& file,
+ const BinaryMessage& pt_string) OVERRIDE;
+ bool UnloadPolicyLibrary() OVERRIDE;
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions,
+ const HMILevel& default_hmi) OVERRIDE;
+
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions) OVERRIDE;
+
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE;
+
+ virtual bool GetPriority(const std::string& policy_app_id,
+ std::string* priority) const OVERRIDE;
+ void CheckPermissions(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result) OVERRIDE;
+
+ uint32_t GetNotificationsNumber(const std::string& priority) const OVERRIDE;
+ virtual DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const OVERRIDE;
+ bool GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi) const OVERRIDE;
+ bool GetInitialAppData(const std::string& application_id,
+ StringArray* nicknames = NULL,
+ StringArray* app_hmi_types = NULL) OVERRIDE;
+ void GetServiceUrls(const std::string& service_type,
+ EndpointUrls& end_points) OVERRIDE;
+ virtual std::string GetLockScreenIconUrl() const OVERRIDE;
+ void ResetRetrySequence() OVERRIDE;
+ uint32_t NextRetryTimeout() OVERRIDE;
+ int TimeoutExchange() OVERRIDE;
+ void OnExceededTimeout() OVERRIDE;
+ void OnSystemReady() OVERRIDE;
+ void PTUpdatedAt(Counters counter, int value) OVERRIDE;
+ void add_listener(PolicyHandlerObserver* listener) OVERRIDE;
+ void remove_listener(PolicyHandlerObserver* listener) OVERRIDE;
+
+ utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager()
+ const OVERRIDE;
/**
* @brief CheckSystemAction allows to check whether certain system
@@ -121,47 +134,56 @@ public:
* @return true if specified system action is enabled, false otherwise.
*/
bool CheckSystemAction(mobile_apis::SystemAction::eType system_action,
- const std::string &policy_app_id);
+ const std::string& policy_app_id) const OVERRIDE;
/**
* Lets client to notify PolicyHandler that more kilometers expired
* @param kms New value of odometer
*/
- void KmsChanged(int kms);
+ void KmsChanged(int kms) OVERRIDE;
/**
* @brief Gather information for application and sends it to HMI
* @param connection_key Connection key for application
*/
- void OnActivateApp(uint32_t connection_key, uint32_t correlation_id);
+ void OnActivateApp(uint32_t connection_key, uint32_t correlation_id) OVERRIDE;
/**
* @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);
+ void OnAllowSDLFunctionalityNotification(
+ bool is_allowed, const std::string& device_id) OVERRIDE;
/**
* @brief Increment counter for ignition cycles
*/
- void OnIgnitionCycleOver();
+ void OnIgnitionCycleOver() OVERRIDE;
- void OnPendingPermissionChange(const std::string &policy_app_id);
+ void OnPendingPermissionChange(const std::string& policy_app_id) OVERRIDE;
/**
* Initializes PT exchange at user request
* @param correlation_id correlation id of request
*/
- void PTExchangeAtUserRequest(uint32_t correlation_id);
+ void PTExchangeAtUserRequest(uint32_t correlation_id) OVERRIDE;
+
+ /**
+ * @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) OVERRIDE;
/**
* @brief Save device info for specific device to policy table
* @param device_id Device mac address
* @param device_info Device params
*/
- void SetDeviceInfo(std::string &device_id, const DeviceInfo &device_info);
+ void SetDeviceInfo(const std::string& device_id,
+ const DeviceInfo& device_info) OVERRIDE;
/**
* @brief Store user-changed permissions consent to DB
@@ -170,7 +192,7 @@ public:
* @param permissions User-changed group permissions consent
*/
void OnAppPermissionConsent(const uint32_t connection_key,
- const PermissionConsent &permissions);
+ const PermissionConsent& permissions) OVERRIDE;
/**
* @brief Get appropriate message parameters and send them with response
@@ -179,9 +201,9 @@ public:
* @param language Language
* @param correlation_id correlation id of request
*/
- void OnGetUserFriendlyMessage(const std::vector<std::string> &message_codes,
- const std::string &language,
- uint32_t correlation_id);
+ void OnGetUserFriendlyMessage(const std::vector<std::string>& message_codes,
+ const std::string& language,
+ uint32_t correlation_id) OVERRIDE;
/**
* @brief Get list of permissions for application/device binded to
@@ -191,32 +213,33 @@ public:
* @param correlation_id Correlation id from request
*/
void OnGetListOfPermissions(const uint32_t connection_key,
- const uint32_t correlation_id);
+ const uint32_t correlation_id) OVERRIDE;
/**
* @brief Get current policy table update state and send response
* @param correlation_id Correlation id from request
*/
- void OnGetStatusUpdate(const uint32_t correlation_id);
+ void OnGetStatusUpdate(const uint32_t correlation_id) OVERRIDE;
/**
* @brief Send notification to HMI with changed policy update status
* @param status Current policy update state
*/
- void OnUpdateStatusChanged(const std::string &status);
+ void OnUpdateStatusChanged(const std::string& status) OVERRIDE;
/**
* @brief Update currently used device id in policies manager for given
* 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) OVERRIDE;
/**
* @brief Set parameters from OnSystemInfoChanged to policy table
* @param language System language
*/
- void OnSystemInfoChanged(const std::string &language);
+ void OnSystemInfoChanged(const std::string& language) OVERRIDE;
/**
* @brief Save data from GetSystemInfo request to policy table
@@ -224,116 +247,114 @@ public:
* @param wers_country_code WERS country code
* @param language System language
*/
- void OnGetSystemInfo(const std::string &ccpu_version,
- const std::string &wers_country_code,
- const std::string &language);
+ void OnGetSystemInfo(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language) OVERRIDE;
/**
* @brief Send request to HMI to get update on system parameters
*/
- void OnSystemInfoUpdateRequired() OVERRIDE;
+ virtual void OnSystemInfoUpdateRequired() OVERRIDE;
/**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
- virtual void OnVIIsReady();
+ virtual void OnVIIsReady() OVERRIDE;
/**
* @brief Allows to update vechicle data info.
* @param SmartObject which contains all needed information.
*/
- virtual void OnVehicleDataUpdated(const smart_objects::SmartObject &message);
+ virtual void OnVehicleDataUpdated(
+ const smart_objects::SmartObject& message) OVERRIDE;
/**
* Removes device
* @param device_id id of device
*/
- void RemoveDevice(const std::string &device_id);
+ void RemoveDevice(const std::string& device_id) OVERRIDE;
/**
* Adds statistics info
* @param type type of info
*/
- void AddStatisticsInfo(int type);
+ void AddStatisticsInfo(int type) OVERRIDE;
/**
* Handles system error
* @param code code of error
*/
- void OnSystemError(int code);
+ void OnSystemError(int code) OVERRIDE;
/**
* @brief Choose application id to be used for snapshot sending
* @return Application id or 0, if there are no applications registered
*/
- uint32_t GetAppIdForSending();
+ uint32_t GetAppIdForSending() const OVERRIDE;
- std::string GetAppName(const std::string &policy_app_id);
+ custom_str::CustomString GetAppName(
+ const std::string& policy_app_id) OVERRIDE;
- void
- OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
+ virtual void OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
- void OnCertificateUpdated(const std::string &certificate_data) OVERRIDE;
+ virtual void OnCertificateUpdated(
+ const std::string& certificate_data) OVERRIDE;
- bool CanUpdate() OVERRIDE;
+ virtual bool CanUpdate() OVERRIDE;
- void OnDeviceConsentChanged(const std::string &device_id,
- bool is_allowed) OVERRIDE;
+ virtual void OnDeviceConsentChanged(const std::string& device_id,
+ const bool is_allowed) OVERRIDE;
- virtual void OnPTExchangeNeeded();
+ virtual void SendOnAppPermissionsChanged(
+ const AppPermissions& permissions,
+ const std::string& policy_app_id) const OVERRIDE;
- void GetAvailableApps(std::queue<std::string> &apps) OVERRIDE;
+ virtual void OnPTExchangeNeeded() OVERRIDE;
+
+ virtual void GetAvailableApps(std::queue<std::string>& apps) OVERRIDE;
/**
* @brief Allows to add new or update existed application during
* registration process
* @param application_id The policy aplication id.
*/
- void AddApplication(const std::string &application_id);
+ void AddApplication(const std::string& application_id) OVERRIDE;
/**
* Checks whether application is revoked
* @param app_id id application
* @return true if application is revoked
*/
- bool IsApplicationRevoked(const std::string &app_id);
+ bool IsApplicationRevoked(const std::string& app_id) OVERRIDE;
/**
* @brief Notifies policy manager, that PTS was sent out
*/
- void OnUpdateRequestSentToMobile();
+ void OnUpdateRequestSentToMobile() OVERRIDE;
/**
* 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 OVERRIDE;
/**
* @brief Returns URL for querying list of remote apps
*/
- const std::string RemoteAppsUrl() const;
+ const std::string RemoteAppsUrl() const OVERRIDE;
/**
* @brief Handler on applications search started
*/
- void OnAppsSearchStarted();
+ void OnAppsSearchStarted() OVERRIDE;
/**
* @brief Handler on applications search completed
*/
- void OnAppsSearchCompleted();
-
- /**
- * @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);
+ void OnAppsSearchCompleted() OVERRIDE;
/**
* @brief Checks if certain request type is allowed for application
@@ -341,34 +362,63 @@ public:
* @param type Request type
* @return true, if allowed, otherwise - false
*/
- bool IsRequestTypeAllowed(const std::string &policy_app_id,
- mobile_apis::RequestType::eType type) const;
+ bool IsRequestTypeAllowed(
+ const std::string& policy_app_id,
+ mobile_apis::RequestType::eType type) const OVERRIDE;
/**
* @brief Gets application request types
* @param policy_app_id Unique application id
* @return request types
*/
- const std::vector<std::string>
- GetAppRequestTypes(const std::string &policy_app_id) const;
+ const std::vector<std::string> GetAppRequestTypes(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ /**
+ * @brief Gets vehicle information
+ * @return Structure with vehicle information
+ */
+ const VehicleInfo GetVehicleInfo() const OVERRIDE;
+
+ /**
+ * @brief OnAppRegisteredOnMobile allows to handle event when application were
+ * succesfully registered on mobile device.
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param application_id registered application.
+ */
+ void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
// 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);
- virtual void Set(const std::string &app_id, usage_statistics::AppInfoId type,
- const std::string &value);
- virtual void Add(const std::string &app_id,
+ virtual void Increment(usage_statistics::GlobalCounterId type) OVERRIDE;
+ virtual void Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type) OVERRIDE;
+ virtual void Set(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value) OVERRIDE;
+ virtual void Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
- int32_t timespan_seconds);
+ int32_t timespan_seconds) OVERRIDE;
+
+#ifdef BUILD_TESTS
+ void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) {
+ policy_manager_ = pm;
+ }
+#endif // BUILD_TESTS
+
+#ifdef ENABLE_SECURITY
+ std::string RetrieveCertificate() const OVERRIDE;
+#endif // ENABLE_SECURITY
-protected:
+ const PolicySettings& get_settings() const OVERRIDE;
+
+ protected:
/**
* Starts next retry exchange policy table
*/
void StartNextRetry();
-private:
+ private:
/**
* Checks system action of application for permission of keep context
* @param system_action system action (see mobile api)
@@ -377,7 +427,7 @@ private:
* policy
* otherwise true
*/
- bool CheckKeepContext(const std::string &policy_app_id);
+ bool CheckKeepContext(const std::string& policy_app_id) const;
/**
* Checks system action of application for permission of steal focus
@@ -387,7 +437,7 @@ private:
* policy
* otherwise true
*/
- bool CheckStealFocus(const std::string &policy_app_id);
+ bool CheckStealFocus(const std::string& policy_app_id) const;
/**
* @brief OnAppPermissionConsentInternal reacts on permission changing
@@ -397,47 +447,54 @@ private:
* @param permissions new permissions.
*/
void OnAppPermissionConsentInternal(const uint32_t connection_key,
- PermissionConsent &permissions);
+ PermissionConsent& permissions) OVERRIDE;
+
+ /**
+ * @brief Sets days after epoch on successful policy update
+ */
+ void SetDaysAfterEpoch();
-private:
+ private:
class StatisticManagerImpl : public usage_statistics::StatisticsManager {
+ public:
+ StatisticManagerImpl(PolicyHandler* policy_handler)
+ : policy_handler_(policy_handler) {
+ DCHECK(policy_handler_);
+ }
// TODO(AKutsan) REMOVE THIS UGLY HOTFIX
virtual void Increment(usage_statistics::GlobalCounterId type) {
-
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(type));
+ policy_handler_->AsyncRun(new StatisticsDelegate(*policy_handler_, type));
}
- virtual void Increment(const std::string &app_id,
- usage_statistics::AppCounterId type) {
-
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(app_id, type));
+ void Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type) {
+ policy_handler_->AsyncRun(
+ new StatisticsDelegate(*policy_handler_, 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));
+ void Set(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value) {
+ policy_handler_->AsyncRun(
+ new StatisticsDelegate(*policy_handler_, 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));
+ void Add(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds) {
+ policy_handler_->AsyncRun(new StatisticsDelegate(
+ *policy_handler_, app_id, type, timespan_seconds));
}
+
+ private:
+ PolicyHandler* policy_handler_;
};
- // TODO(AKutsan) REMOVE THIS UGLY HOTFIX
- PolicyHandler();
- bool SaveSnapshot(const BinaryMessage &pt_string, std::string &snap_path);
- static PolicyHandler *instance_;
+ bool SaveSnapshot(const BinaryMessage& pt_string, std::string& snap_path);
static const std::string kLibrary;
mutable sync_primitives::RWLock policy_manager_lock_;
utils::SharedPtr<PolicyManager> policy_manager_;
- void *dl_handle_;
+ void* dl_handle_;
AppIds last_used_app_ids_;
utils::SharedPtr<PolicyEventObserver> event_observer_;
uint32_t last_activated_app_id_;
@@ -449,7 +506,7 @@ private:
inline bool CreateManager();
- typedef std::list<PolicyHandlerObserver *> HandlersCollection;
+ typedef std::list<PolicyHandlerObserver*> HandlersCollection;
HandlersCollection listeners_;
sync_primitives::Lock listeners_lock_;
@@ -463,15 +520,13 @@ private:
sync_primitives::Lock app_to_device_link_lock_;
utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_;
-
+ const PolicySettings& settings_;
+ application_manager::ApplicationManager& application_manager_;
friend class AppPermissionDelegate;
DISALLOW_COPY_AND_ASSIGN(PolicyHandler);
- FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(
- PolicyHandler, utils::deleters::Deleter<PolicyHandler>);
- FRIEND_DELETER_DESTRUCTOR(PolicyHandler);
};
-} // namespace policy
+} // namespace policy
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_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..794da0cdfb 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,19 @@
#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) {}
+class PolicyHandlerObserver {
+ public:
+ 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/policies/pt_exchange_handler.h b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h
index 31f7ded507..4e543eae96 100644
--- a/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h
@@ -37,10 +37,10 @@
namespace policy {
class PTExchangeHandler {
- public:
- virtual ~PTExchangeHandler() {};
- virtual void Start() = 0;
- virtual void Stop() = 0;
+ public:
+ virtual ~PTExchangeHandler(){};
+ virtual void Start() = 0;
+ virtual void Stop() = 0;
};
} // 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..237d9f5d8a 100644
--- a/src/components/application_manager/include/application_manager/request_controller.h
+++ b/src/components/application_manager/include/application_manager/request_controller.h
@@ -42,13 +42,13 @@
#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"
-
+#include "application_manager/request_controller_settings.h"
namespace application_manager {
@@ -59,233 +59,231 @@ namespace request_controller {
* requests.
*/
class RequestController {
- public:
- /**
- * @brief Result code for addRequest
- */
- enum TResult {
- SUCCESS = 0,
- TOO_MANY_REQUESTS,
- TOO_MANY_PENDING_REQUESTS,
- NONE_HMI_LEVEL_MANY_REQUESTS,
- INVALID_DATA
- };
-
- /**
- * @brief Thread pool state
- */
- enum TPoolState {
- UNDEFINED = 0,
- STARTED,
- STOPPED,
- };
-
- // Methods
-
- /**
- * @brief Class constructor
- *
- */
- RequestController();
-
- /**
- * @brief Class destructor
- *
- */
- virtual ~RequestController();
-
- /**
- * @brief Initialize thread pool
- *
- */
- void InitializeThreadpool();
-
- /**
- * @brief Destroy thread pool
- *
- */
- void DestroyThreadpool();
-
- /**
- * @brief Check if max request amount wasn't exceed and adds request to queue.
- *
- * @param request Active mobile request
- * @param hmi_level Current application hmi_level
- *
- * @return Result code
- *
- */
- TResult addMobileRequest(const RequestPtr request,
- const mobile_apis::HMILevel::eType& hmi_level);
-
-
- /**
- * @brief Store HMI request until response or timeout won't remove it
- *
- * @param request Active hmi request
- * @return Result code
- *
- */
- TResult addHMIRequest(const RequestPtr request);
-
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void addNotification(const RequestPtr ptr);
-
-
- /**
- * @brief Removes request from queue
- *
- * @param correlation_id Active request correlation ID,
- * @param connection_key Active request connection key (0 for HMI requersts)
- * @param force_terminate if true, request controller will terminate
- * even if not allowed by request
- */
- void terminateRequest(const uint32_t& correlation_id,
- const uint32_t& connection_key,
- bool force_terminate = false);
-
- /**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
- void OnMobileResponse(const uint32_t& mobile_correlation_id,
- const uint32_t& connection_key);
-
-
- /**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
- void OnHMIResponse(const uint32_t& correlation_id);
-
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void removeNotification(const commands::Command* notification);
-
- /**
- * @brief Removes all requests from queue for specified application
- *
- * @param app_id Mobile application ID (app_id)
- *
- */
- void terminateAppRequests(const uint32_t& app_id);
-
- /**
- * @brief Terminates all requests from HMI
- */
- void terminateAllHMIRequests();
-
-
- /**
- * @brief Terminates all requests from Mobile
- */
- void terminateAllMobileRequests();
-
- /**
- * @brief Updates request timeout
- *
- * @param app_id Connection key of application
- * @param mobile_correlation_id Correlation ID of the mobile request
- * @param new_timeout_value New timeout to be set in milliseconds
- */
- void updateRequestTimeout(const uint32_t& app_id,
- const uint32_t& mobile_correlation_id,
- const uint32_t& new_timeout);
-
- /*
- * @brief Function Should be called when Low Voltage is occured
- */
- void OnLowVoltage();
-
- /*
- * @brief Function Should be called when Low Voltage is occured
- */
- void OnWakeUp();
-
- bool IsLowVoltage();
-
- protected:
- /**
- * @brief Timer Callback
- */
- void onTimer();
-
- /**
- * @brief Update timout for next OnTimer
- * Not thread safe
- */
- void UpdateTimer();
-
- void terminateWaitingForExecutionAppRequests(const uint32_t& app_id);
- void terminateWaitingForResponseAppRequests(const uint32_t& app_id);
-
- /**
- * @brief Check Posibility to add new requests, or limits was exceeded
- * @param request - request to check possipility to Add
- * @return True if new request could be added, false otherwise
- */
- TResult CheckPosibilitytoAdd(const RequestPtr request);
-
- /**
- * @brief Check Posibility to add new requests, or limits was exceeded
- * @param pending_requests_amount - maximum count of request that should be allowed for all applications
- * @return True if new request could be added, false otherwise
- */
- bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount);
-
- private:
- class Worker : public threads::ThreadDelegate {
- public:
- explicit Worker(RequestController* requestController);
- virtual ~Worker();
- virtual void threadMain();
- virtual void exitThreadMain();
- protected:
- private:
- RequestController* request_controller_;
- sync_primitives::Lock thread_lock_;
- volatile bool stop_flag_;
- };
-
- std::vector<threads::Thread*> pool_;
- volatile TPoolState pool_state_;
- uint32_t pool_size_;
- sync_primitives::ConditionalVariable cond_var_;
-
- std::list<RequestInfoPtr> mobile_request_info_list_;
- sync_primitives::Lock mobile_request_info_list_lock_;
-
- /*
- * Requests, that are waiting for responses
- * RequestInfoSet provides correct processing of requests with thre same
- * app_id and corr_id
- */
- RequestInfoSet waiting_for_response_;
-
- /**
- * @brief Set of HMI notifications with timeout.
- */
- std::list<RequestPtr> notification_list_;
-
- /*
- * timer for checking requests timeout
- */
- timer::TimerThread<RequestController> timer_;
- static const uint32_t dafault_sleep_time_ = UINT_MAX;
-
- bool is_low_voltage_;
- DISALLOW_COPY_AND_ASSIGN(RequestController);
+ public:
+ /**
+ * @brief Result code for addRequest
+ */
+ enum TResult {
+ SUCCESS = 0,
+ TOO_MANY_REQUESTS,
+ TOO_MANY_PENDING_REQUESTS,
+ NONE_HMI_LEVEL_MANY_REQUESTS,
+ INVALID_DATA
+ };
+
+ /**
+ * @brief Thread pool state
+ */
+ enum TPoolState {
+ UNDEFINED = 0,
+ STARTED,
+ STOPPED,
+ };
+
+ // Methods
+
+ /**
+ * @brief Class constructor
+ *
+ */
+ RequestController(const RequestControlerSettings& settings);
+
+ /**
+ * @brief Class destructor
+ *
+ */
+ virtual ~RequestController();
+
+ /**
+ * @brief Initialize thread pool
+ *
+ */
+ void InitializeThreadpool();
+
+ /**
+ * @brief Destroy thread pool
+ *
+ */
+ void DestroyThreadpool();
+
+ /**
+ * @brief Check if max request amount wasn't exceed and adds request to queue.
+ *
+ * @param request Active mobile request
+ * @param hmi_level Current application hmi_level
+ *
+ * @return Result code
+ *
+ */
+ TResult addMobileRequest(const RequestPtr request,
+ const mobile_apis::HMILevel::eType& hmi_level);
+
+ /**
+ * @brief Store HMI request until response or timeout won't remove it
+ *
+ * @param request Active hmi request
+ * @return Result code
+ *
+ */
+ TResult addHMIRequest(const RequestPtr request);
+
+ /**
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
+ void addNotification(const RequestPtr ptr);
+
+ /**
+ * @brief Removes request from queue
+ *
+ * @param correlation_id Active request correlation ID,
+ * @param connection_key Active request connection key (0 for HMI requersts)
+ * @param force_terminate if true, request controller will terminate
+ * even if not allowed by request
+ */
+ void terminateRequest(const uint32_t& correlation_id,
+ const uint32_t& connection_key,
+ bool force_terminate = false);
+
+ /**
+ * @brief Removes request from queue
+ *
+ * @param mobile_correlation_id Active mobile request correlation ID
+ *
+ */
+ void OnMobileResponse(const uint32_t& mobile_correlation_id,
+ const uint32_t& connection_key);
+
+ /**
+ * @brief Removes request from queue
+ *
+ * @param mobile_correlation_id Active mobile request correlation ID
+ *
+ */
+ void OnHMIResponse(const uint32_t& correlation_id);
+
+ /**
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
+ void removeNotification(const commands::Command* notification);
+
+ /**
+ * @brief Removes all requests from queue for specified application
+ *
+ * @param app_id Mobile application ID (app_id)
+ *
+ */
+ void terminateAppRequests(const uint32_t& app_id);
+
+ /**
+ * @brief Terminates all requests from HMI
+ */
+ void terminateAllHMIRequests();
+
+ /**
+ * @brief Terminates all requests from Mobile
+ */
+ void terminateAllMobileRequests();
+
+ /**
+ * @brief Updates request timeout
+ *
+ * @param app_id Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ * @param new_timeout_value New timeout to be set in milliseconds
+ */
+ void updateRequestTimeout(const uint32_t& app_id,
+ const uint32_t& mobile_correlation_id,
+ const uint32_t& new_timeout);
+
+ /*
+ * @brief Function Should be called when Low Voltage is occured
+ */
+ void OnLowVoltage();
+
+ /*
+ * @brief Function Should be called when Low Voltage is occured
+ */
+ void OnWakeUp();
+
+ bool IsLowVoltage();
+
+ protected:
+ /**
+ * @brief Timer Callback
+ */
+ void onTimer();
+
+ /**
+ * @brief Update timout for next OnTimer
+ * Not thread safe
+ */
+ void UpdateTimer();
+
+ void terminateWaitingForExecutionAppRequests(const uint32_t& app_id);
+ void terminateWaitingForResponseAppRequests(const uint32_t& app_id);
+
+ /**
+ * @brief Check Posibility to add new requests, or limits was exceeded
+ * @param request - request to check possipility to Add
+ * @return True if new request could be added, false otherwise
+ */
+ TResult CheckPosibilitytoAdd(const RequestPtr request);
+
+ /**
+ * @brief Check Posibility to add new requests, or limits was exceeded
+ * @param pending_requests_amount - maximum count of request that should be
+ * allowed for all applications
+ * @return True if new request could be added, false otherwise
+ */
+ bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount);
+
+ private:
+ class Worker : public threads::ThreadDelegate {
+ public:
+ explicit Worker(RequestController* requestController);
+ virtual ~Worker();
+ virtual void threadMain();
+ virtual void exitThreadMain();
+
+ protected:
+ private:
+ RequestController* request_controller_;
+ sync_primitives::Lock thread_lock_;
+ volatile bool stop_flag_;
+ };
+
+ std::vector<threads::Thread*> pool_;
+ volatile TPoolState pool_state_;
+ uint32_t pool_size_;
+ sync_primitives::ConditionalVariable cond_var_;
+
+ std::list<RequestPtr> mobile_request_list_;
+ sync_primitives::Lock mobile_request_list_lock_;
+
+ /*
+ * Requests, that are waiting for responses
+ * RequestInfoSet provides correct processing of requests with thre same
+ * app_id and corr_id
+ */
+ RequestInfoSet waiting_for_response_;
+
+ /**
+ * @brief Set of HMI notifications with timeout.
+ */
+ std::list<RequestPtr> notification_list_;
+
+ /*
+ * timer for checking requests timeout
+ */
+ timer::Timer timer_;
+
+ bool is_low_voltage_;
+ const RequestControlerSettings& settings_;
+ DISALLOW_COPY_AND_ASSIGN(RequestController);
};
} // namespace request_controller
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 25fd025f76..c0a85e1f5e 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -48,344 +48,336 @@ namespace application_manager {
namespace request_controller {
+/*
+ * @brief Typedef for active mobile request
+ *
+ */
+typedef utils::SharedPtr<commands::Command> RequestPtr;
+
+struct RequestInfo {
+ enum RequestType { RequestNone, MobileRequest, HMIRequest };
+
+ RequestInfo()
+ : timeout_msec_(0)
+ , app_id_(0)
+ , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
+ , requst_type_(RequestNone)
+ , correlation_id_(0) {
+ start_time_ = date_time::DateTime::getCurrentTime();
+ updateEndTime();
+ }
+ virtual ~RequestInfo() {}
+
+ RequestInfo(RequestPtr request,
+ const RequestType requst_type,
+ const uint64_t timeout_msec)
+ : request_(request)
+ , timeout_msec_(timeout_msec)
+ , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
+ , correlation_id_(0) {
+ 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_msec);
+
+ void updateEndTime();
+
+ void updateTimeOut(const uint64_t& timeout_msec);
+
+ bool isExpired();
+
+ TimevalStruct start_time() {
+ return start_time_;
+ }
+
+ void update_start_time(TimevalStruct start_time) {
+ start_time_ = start_time;
+ }
+
+ uint64_t timeout_msec() {
+ return timeout_msec_;
+ }
+
+ void set_timeout_msec(uint64_t timeout) {
+ timeout_msec_ = timeout;
+ }
+
+ TimevalStruct end_time() {
+ return end_time_;
+ }
+
+ uint32_t app_id() {
+ return app_id_;
+ }
+
+ mobile_apis::HMILevel::eType hmi_level() {
+ return hmi_level_;
+ }
+
+ void set_hmi_level(const mobile_apis::HMILevel::eType& level) {
+ hmi_level_ = level;
+ }
+
+ RequestType requst_type() const {
+ return requst_type_;
+ }
+
+ uint32_t requestId() {
+ return correlation_id_;
+ }
+
+ commands::Command* request() {
+ return request_.get();
+ }
+ uint64_t hash();
+ static uint64_t GenerateHash(uint32_t var1, uint32_t var2);
+ static uint32_t HmiConnectoinKey;
+
+ protected:
+ RequestPtr request_;
+ TimevalStruct start_time_;
+ uint64_t timeout_msec_;
+ TimevalStruct end_time_;
+ uint32_t app_id_;
+ mobile_apis::HMILevel::eType hmi_level_;
+ RequestType requst_type_;
+ uint32_t correlation_id_;
+};
+
+typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
+
+struct MobileRequestInfo : public RequestInfo {
+ MobileRequestInfo(RequestPtr request, const uint64_t timeout_msec);
+ MobileRequestInfo(RequestPtr request,
+ const TimevalStruct& start_time,
+ const uint64_t timeout_msec);
+};
+
+struct HMIRequestInfo : public RequestInfo {
+ HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec);
+ HMIRequestInfo(RequestPtr request,
+ const TimevalStruct& start_time,
+ const uint64_t timeout_msec);
+};
+
+// Request info, for searching in request info set by log_n time
+// Returns correct hash by app_id and corr_id
+struct FakeRequestInfo : public RequestInfo {
+ FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id);
+};
+
+struct RequestInfoTimeComparator {
+ bool operator()(const RequestInfoPtr lhs, const RequestInfoPtr rhs) const;
+};
+
+struct RequestInfoHashComparator {
+ bool operator()(const RequestInfoPtr lhs, const RequestInfoPtr rhs) const;
+};
+
+typedef std::set<RequestInfoPtr, RequestInfoTimeComparator>
+ TimeSortedRequestInfoSet;
+typedef std::set<RequestInfoPtr, RequestInfoHashComparator>
+ HashSortedRequestInfoSet;
+
+/*
+ * @brief RequestInfoSet provides uniue requests bu corralation_id and app_id
+ *
+ */
+class RequestInfoSet {
+ public:
/*
- * @brief Typedef for active mobile request
- *
+ * @brief Add requests into colletion by log(n) time
+ * @param request_info - request to add
+ * @return false is request with the same app_id and correlation_id exist
*/
- typedef utils::SharedPtr<commands::Command> RequestPtr;
-
- struct RequestInfo {
- enum RequestType {RequestNone, MobileRequest, HMIRequest};
-
- RequestInfo()
- : timeout_sec_(0),
- app_id_(0),
- hmi_level_(mobile_apis::HMILevel::INVALID_ENUM),
- requst_type_(RequestNone),
- correlation_id_(0) {
- start_time_ = date_time::DateTime::getCurrentTime();
- updateEndTime();
- }
- virtual ~RequestInfo() {}
-
- RequestInfo(RequestPtr request,
- const RequestType requst_type,
- const uint64_t timeout_sec)
- : request_(request),
- timeout_sec_(timeout_sec),
- app_id_(0),
- hmi_level_(mobile_apis::HMILevel::INVALID_ENUM),
- correlation_id_(0) {
- 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);
-
- void updateEndTime();
-
- void updateTimeOut(const uint64_t& timeout_sec);
-
- bool isExpired();
-
- TimevalStruct start_time() {
- return start_time_;
- }
+ bool Add(RequestInfoPtr request_info);
- void update_start_time(TimevalStruct start_time) {
- start_time_ = start_time;
- }
+ /*
+ * @brief Find requests int colletion by log(n) time
+ * @param connection_key - connection_key of request
+ * @param correlation_id - correlation_id of request
+ * @return founded request or shared_ptr with NULL
+ */
+ RequestInfoPtr Find(const uint32_t connection_key,
+ const uint32_t correlation_id);
- uint64_t timeout_sec() {
- return timeout_sec_;
- }
+ /*
+ * @brief Get request with smalest end_time_
+ * @return founded request or shared_ptr with NULL
+ */
+ RequestInfoPtr Front();
- void set_timeout_sec(uint64_t timeout) {
- timeout_sec_ = timeout;
- }
+ /*
+ * @brief Get request with smalest end_time_ != 0
+ * @return founded request or shared_ptr with NULL
+ */
+ RequestInfoPtr FrontWithNotNullTimeout();
- TimevalStruct end_time() {
- return end_time_;
- }
+ /*
+ * @brief Erase request from colletion by log(n) time
+ * @param request_info - request to erase
+ * @return true if Erase succes, otherwise return false
+ */
+ bool RemoveRequest(const RequestInfoPtr request_info);
- uint32_t app_id() {
- return app_id_;
- }
+ /*
+ * @brief Erase request from colletion by connection_key
+ * @param connection_key - connection_key of requests to erase
+ * @return count of erased requests
+ */
+ uint32_t RemoveByConnectionKey(uint32_t connection_key);
- mobile_apis::HMILevel::eType hmi_level() {
- return hmi_level_;
- }
+ /*
+ * @brief Erase all mobile requests from controller
+ * @return count of erased requests
+ */
+ uint32_t RemoveMobileRequests();
- void set_hmi_level(const mobile_apis::HMILevel::eType& level) {
- hmi_level_ = level;
- }
+ /*
+ * @return count of requestd in collections
+ */
+ const size_t Size();
- RequestType requst_type() const {
- return requst_type_;
- }
+ /**
+ * @brief Check if this app is able to add new requests,
+ * or limits was exceeded
+ * @param app_id - application id
+ * @param app_time_scale - time scale (seconds)
+ * @param max_request_per_time_scale - maximum count of request
+ * that should be allowed for app_time_scale seconds
+ * @return True if new request could be added, false otherwise
+ */
+ bool CheckTimeScaleMaxRequest(uint32_t app_id,
+ uint32_t app_time_scale,
+ uint32_t max_request_per_time_scale);
- uint32_t requestId() {
- return correlation_id_;
- }
+ /**
+ * @brief Check if this app is able to add new requests
+ * in current hmi_level, or limits was exceeded
+ * @param hmi_level - hmi level
+ * @param app_id - application id
+ * @param app_time_scale - time scale (seconds)
+ * @param max_request_per_time_scale - maximum count of request
+ * that should be allowed for app_time_scale seconds
+ * @return True if new request could be added, false otherwise
+ */
+ bool CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level,
+ uint32_t app_id,
+ uint32_t app_time_scale,
+ uint32_t max_request_per_time_scale);
- commands::Command* request() {
- return request_.get();
- }
- uint64_t hash();
- static uint64_t GenerateHash(uint32_t var1, uint32_t var2);
- static uint32_t HmiConnectoinKey;
- protected:
- RequestPtr request_;
- TimevalStruct start_time_;
- uint64_t timeout_sec_;
- TimevalStruct end_time_;
- uint32_t app_id_;
- mobile_apis::HMILevel::eType hmi_level_;
- RequestType requst_type_;
- uint32_t correlation_id_;
+ private:
+ /*
+ * @brief Comparator of connection key for std::find_if function
+ */
+ struct AppIdCompararator {
+ enum CompareType { Equal, NotEqual };
+ AppIdCompararator(CompareType compare_type, uint32_t app_id)
+ : app_id_(app_id), compare_type_(compare_type) {}
+ bool operator()(const RequestInfoPtr value_compare) const;
+
+ private:
+ uint32_t app_id_;
+ CompareType compare_type_;
};
- typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
+ bool Erase(const RequestInfoPtr request_info);
- struct MobileRequestInfo: public RequestInfo {
- MobileRequestInfo(RequestPtr request,
- const uint64_t timeout_sec);
- MobileRequestInfo(RequestPtr request,
- const TimevalStruct& start_time,
- const uint64_t timeout_sec);
- };
+ /*
+ * @brief Erase requests from collection if filter allows
+ * @param filter - filtering predicate
+ * @return count of erased requests
+ */
+ uint32_t RemoveRequests(const RequestInfoSet::AppIdCompararator& filter);
- struct HMIRequestInfo: public RequestInfo {
- HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec);
- HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,
- const uint64_t timeout_sec);
- };
+ /*
+ * @brief Debug function, will raise assert if set sizes are noit equal
+ */
+ inline void CheckSetSizes();
+ TimeSortedRequestInfoSet time_sorted_pending_requests_;
+ HashSortedRequestInfoSet hash_sorted_pending_requests_;
- // Request info, for searching in request info set by log_n time
- // Returns correct hash by app_id and corr_id
- struct FakeRequestInfo :public RequestInfo {
- FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id);
- };
+ // the lock caled this_lock_, since the class represent collection by itself.
+ sync_primitives::Lock this_lock_;
+};
- struct RequestInfoTimeComparator {
- bool operator() (const RequestInfoPtr lhs,
- const RequestInfoPtr rhs) const;
- };
+/**
+* @brief Structure used in std algorithms to determine amount of request
+* during time scale
+*/
+struct TimeScale {
+ TimeScale(const TimevalStruct& start,
+ const TimevalStruct& end,
+ const uint32_t& app_id)
+ : start_(start), end_(end), app_id_(app_id) {}
+
+ bool operator()(RequestInfoPtr setEntry) {
+ if (!setEntry.valid()) {
+ return false;
+ }
- struct RequestInfoHashComparator {
- bool operator() (const RequestInfoPtr lhs,
- const RequestInfoPtr rhs) const;
- };
+ if (setEntry->app_id() != app_id_) {
+ return false;
+ }
+ if ((setEntry->start_time() < start_) || (end_ < setEntry->start_time())) {
+ return false;
+ }
- typedef std::set<RequestInfoPtr, RequestInfoTimeComparator> TimeSortedRequestInfoSet;
- typedef std::set<RequestInfoPtr, RequestInfoHashComparator> HashSortedRequestInfoSet;
+ return true;
+ }
- /*
- * @brief RequestInfoSet provides uniue requests bu corralation_id and app_id
- *
- */
- class RequestInfoSet {
- public:
- /*
- * @brief Add requests into colletion by log(n) time
- * @param request_info - request to add
- * @return false is request with the same app_id and correlation_id exist
- */
- bool Add(RequestInfoPtr request_info);
-
- /*
- * @brief Find requests int colletion by log(n) time
- * @param connection_key - connection_key of request
- * @param correlation_id - correlation_id of request
- * @return founded request or shared_ptr with NULL
- */
- RequestInfoPtr Find(const uint32_t connection_key,
- const uint32_t correlation_id);
-
- /*
- * @brief Get request with smalest end_time_
- * @return founded request or shared_ptr with NULL
- */
- RequestInfoPtr Front();
-
- /*
- * @brief Get request with smalest end_time_ != 0
- * @return founded request or shared_ptr with NULL
- */
- RequestInfoPtr FrontWithNotNullTimeout();
-
- /*
- * @brief Erase request from colletion by log(n) time
- * @param request_info - request to erase
- * @return true if Erase succes, otherwise return false
- */
- bool RemoveRequest(const RequestInfoPtr request_info);
-
- /*
- * @brief Erase request from colletion by connection_key
- * @param connection_key - connection_key of requests to erase
- * @return count of erased requests
- */
- uint32_t RemoveByConnectionKey(uint32_t connection_key);
-
- /*
- * @brief Erase all mobile requests from controller
- * @return count of erased requests
- */
- uint32_t RemoveMobileRequests();
-
- /*
- * @return count of requestd in collections
- */
- const size_t Size();
-
- /**
- * @brief Check if this app is able to add new requests,
- * or limits was exceeded
- * @param app_id - application id
- * @param app_time_scale - time scale (seconds)
- * @param max_request_per_time_scale - maximum count of request
- * that should be allowed for app_time_scale seconds
- * @return True if new request could be added, false otherwise
- */
- bool CheckTimeScaleMaxRequest(uint32_t app_id,
- uint32_t app_time_scale,
- uint32_t max_request_per_time_scale);
-
- /**
- * @brief Check if this app is able to add new requests
- * in current hmi_level, or limits was exceeded
- * @param hmi_level - hmi level
- * @param app_id - application id
- * @param app_time_scale - time scale (seconds)
- * @param max_request_per_time_scale - maximum count of request
- * that should be allowed for app_time_scale seconds
- * @return True if new request could be added, false otherwise
- */
- bool CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level,
- uint32_t app_id,
- uint32_t app_time_scale,
- uint32_t max_request_per_time_scale);
- private:
- /*
- * @brief Comparator of connection key for std::find_if function
- */
- struct AppIdCompararator {
- enum CompareType {Equal, NotEqual};
- AppIdCompararator(CompareType compare_type, uint32_t app_id):
- app_id_(app_id),
- compare_type_(compare_type) {}
- bool operator()(const RequestInfoPtr value_compare) const;
-
- private:
- uint32_t app_id_;
- CompareType compare_type_;
- };
-
- bool Erase(const RequestInfoPtr request_info);
-
- /*
- * @brief Erase requests from collection if filter allows
- * @param filter - filtering predicate
- * @return count of erased requests
- */
- uint32_t RemoveRequests(const RequestInfoSet::AppIdCompararator& filter);
-
- /*
- * @brief Debug function, will raise assert if set sizes are noit equal
- */
- inline void CheckSetSizes();
- TimeSortedRequestInfoSet time_sorted_pending_requests_;
- HashSortedRequestInfoSet hash_sorted_pending_requests_;
-
- // the lock caled this_lock_, since the class represent collection by itself.
- sync_primitives::Lock this_lock_;
- };
+ private:
+ TimevalStruct start_;
+ TimevalStruct end_;
+ uint32_t app_id_;
+};
+/**
+* @brief Structure used in std algorithms to determine amount of request
+* during time scale for application in defined hmi level
+*/
+struct HMILevelTimeScale {
+ HMILevelTimeScale(const TimevalStruct& start,
+ const TimevalStruct& end,
+ const uint32_t& app_id,
+ const mobile_apis::HMILevel::eType& hmi_level)
+ : start_(start), end_(end), app_id_(app_id), hmi_level_(hmi_level) {}
+
+ bool operator()(RequestInfoPtr setEntry) {
+ if (!setEntry.valid()) {
+ return false;
+ }
- /**
- * @brief Structure used in std algorithms to determine amount of request
- * during time scale
- */
- struct TimeScale {
- TimeScale(const TimevalStruct& start,
- const TimevalStruct& end,
- const uint32_t& app_id)
- : start_(start),
- end_(end),
- app_id_(app_id) {}
-
- bool operator()(RequestInfoPtr setEntry) {
- if (!setEntry.valid()) {
- return false;
- }
-
- if (setEntry->app_id() != app_id_) {
- 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_)) {
- return false;
- }
-
- return true;
+ if (setEntry->app_id() != app_id_) {
+ return false;
}
- private:
- TimevalStruct start_;
- TimevalStruct end_;
- uint32_t app_id_;
- };
+ if (setEntry->hmi_level() != hmi_level_) {
+ return false;
+ }
- /**
- * @brief Structure used in std algorithms to determine amount of request
- * during time scale for application in defined hmi level
- */
- struct HMILevelTimeScale {
- HMILevelTimeScale(const TimevalStruct& start,
- const TimevalStruct& end,
- const uint32_t& app_id,
- const mobile_apis::HMILevel::eType& hmi_level)
- : start_(start),
- end_(end),
- app_id_(app_id),
- hmi_level_(hmi_level) {}
-
- bool operator()(RequestInfoPtr setEntry) {
- if (!setEntry.valid()) {
- return false;
- }
-
- if (setEntry->app_id() != app_id_) {
- return false;
- }
-
- if (setEntry->hmi_level() != hmi_level_) {
- return false;
- }
-
- if (date_time::DateTime::getSecs(setEntry->start_time())
- < date_time::DateTime::getSecs(start_) ||
- date_time::DateTime::getSecs(setEntry->start_time())
- > date_time::DateTime::getSecs(end_)) {
- return false;
- }
-
- return true;
+ if (date_time::DateTime::getSecs(setEntry->start_time()) <
+ date_time::DateTime::getSecs(start_) ||
+ date_time::DateTime::getSecs(setEntry->start_time()) >
+ date_time::DateTime::getSecs(end_)) {
+ return false;
}
- private:
- TimevalStruct start_;
- TimevalStruct end_;
- uint32_t app_id_;
- mobile_apis::HMILevel::eType hmi_level_;
- };
+ return true;
+ }
+
+ private:
+ TimevalStruct start_;
+ TimevalStruct end_;
+ uint32_t app_id_;
+ mobile_apis::HMILevel::eType hmi_level_;
+};
} // namespace request_controller
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..853f91ff23
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -0,0 +1,506 @@
+/*
+ * 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 "application_manager/resumption/resumption_data.h"
+#include "utils/timer.h"
+
+namespace application_manager {
+class ApplicationManager;
+class Application;
+}
+
+namespace resumption {
+
+class LastState;
+
+/**
+ * @brief Contains logic for storage/restore data of applications.
+ */
+
+class ResumeCtrl : public application_manager::event_engine::EventObserver {
+ public:
+ /**
+ * @brief allows to create ResumeCtrl object
+ */
+ ResumeCtrl(application_manager::ApplicationManager& application_manager);
+
+ /**
+ * @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 application_manager::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(application_manager::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(
+ application_manager::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(
+ application_manager::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(application_manager::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(
+ application_manager::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(
+ application_manager::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 Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in OnSuspend()
+ */
+ 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(application_manager::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(
+ application_manager::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(
+ application_manager::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(
+ application_manager::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_id) 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(
+ application_manager::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(application_manager::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(LastState& last_state);
+
+ /**
+ * @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();
+
+#ifdef BUILD_TESTS
+ void set_resumption_storage(utils::SharedPtr<ResumptionData> mock_storage);
+#endif // BUILD_TESTS
+ private:
+ /**
+ * @brief restores saved data of application
+ * @param application contains application for which restores data
+ * @return true if success, otherwise return false
+ */
+ bool RestoreApplicationData(
+ application_manager::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(application_manager::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(application_manager::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(application_manager::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(application_manager::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(
+ application_manager::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(application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddWayPointsSubscription allows to restore subscription
+ * for WayPoints
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddWayPointsSubscription(
+ application_manager::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(
+ application_manager::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(application_manager::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> ApplicationTimestamp;
+
+ std::set<application_manager::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
+ application_manager::ApplicationSharedPtr app;
+ };
+
+ struct TimeStampComparator {
+ bool operator()(const ApplicationTimestamp& lhs,
+ const ApplicationTimestamp& 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(
+ application_manager::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(const 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 Checks from resume data, if application has been disconnected
+ * unexpectedly
+ * @param app Application section from resume data
+ * @return true, if it has been unexpectedly disconnected, otherwise - false
+ */
+ bool IsUnexpectedlyDisconnected(const smart_objects::SmartObject& app) const;
+
+ /**
+ * @brief Checks, if application can be resumed
+ * @param application Application
+ * @return true, if no restrictions currently, otherwise - false
+ */
+ bool IsResumeAllowed(
+ const application_manager::ApplicationSharedPtr 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_;
+ application_manager::ApplicationManager& application_manager_;
+};
+
+} // 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..469be2c902
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -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.
+ */
+
+#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"
+#include "application_manager/application_manager.h"
+
+namespace application_manager {
+class ApplicationManagerSettings;
+}
+
+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(
+ const application_manager::ApplicationManager& application_manager);
+
+ /**
+ * @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 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 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() = 0;
+
+ /**
+ * @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;
+
+ /**
+ * @brief Persist saves resumption data on file system
+ */
+ virtual void Persist() = 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_;
+ const application_manager::ApplicationManager& application_manager_;
+};
+} // 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..d08ecc2ae1
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -0,0 +1,838 @@
+/*
+ * 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 Show should database be saved in a disk file or in memory
+ */
+enum DbStorage { In_Memory_Storage = 0, In_File_Storage };
+
+/**
+ * @brief class contains logic for representation application data in
+ * data base
+ */
+class ResumptionDataDB : public ResumptionData {
+ public:
+ /**
+ * @brief Constructor of ResumptionDataDB
+ * @param db_storage show database should be saved in a disk file or in memory
+ */
+ ResumptionDataDB(
+ DbStorage db_storage,
+ const application_manager::ApplicationManager& application_manager);
+
+ /**
+ * @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
+ */
+ void SaveApplication(app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ /**
+ * @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 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;
+ /**
+ * @brief Write json resumption info to file system
+ */
+ void Persist() OVERRIDE;
+
+ protected:
+ /**
+ * @brief returns pointer to data base
+ */
+ utils::dbms::SQLDatabase* db() const;
+
+ 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 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..0be6d64db2
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -0,0 +1,235 @@
+/*
+ * 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"
+#include "resumption/last_state.h"
+
+namespace resumption {
+
+/**
+ * @brief class contains logic for representation application data in
+ * json file
+ */
+class ResumptionDataJson : public ResumptionData {
+ public:
+ /**
+ * @brief Constructor of ResumptionDataJson
+ */
+ ResumptionDataJson(
+ LastState& last_state,
+ const application_manager::ApplicationManager& application_manager);
+
+ /**
+ * @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) OVERRIDE;
+
+ /**
+ * @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 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;
+
+ /**
+ * @brief Write json resumption info to file system
+ */
+ void Persist() OVERRIDE;
+
+ resumption::LastState& last_state() const {
+ return last_state_;
+ }
+
+ 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;
+
+ LastState& last_state_;
+ 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..3f8ca3a416
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -0,0 +1,138 @@
+/*
+ * 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;
+extern const std::string kInsertSubscribedForWayPoints;
+extern const std::string kSelectSubscribedForWayPoints;
+extern const std::string kDeleteSubscribedForWayPoints;
+} // 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 cebac3fef3..1fda170c34 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
@@ -37,381 +37,400 @@ namespace application_manager {
namespace strings {
-const char params[] = "params";
-const char message_type[] = "message_type";
-const char correlation_id[] = "correlation_id";
-const char function_id[] = "function_id";
-const char protocol_version[] = "protocol_version";
-const char protocol_type[] = "protocol_type";
-const char connection_key[] = "connection_key";
-const char error[] = "error";
-const char error_msg[] = "message";
-const char default_app_id[] = "default";
-const char msg_params[] = "msg_params";
-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 url[] = "url";
-const char urlScheme[] = "urlScheme";
-const char packageName[] = "packageName";
-const char cmd_icon[] = "cmdIcon";
-const char result_code[] = "resultCode";
-const char success[] = "success";
-const char sync_msg_version[] = "syncMsgVersion";
-const char major_version[] = "majorVersion";
-const char minor_version[] = "minorVersion";
-const char app_name[] = "appName";
-const char ngn_media_screen_app_name[] = "ngnMediaScreenAppName";
-const char vr_synonyms[] = "vrSynonyms";
-const char uses_vehicle_data[] = "usesVehicleData";
-const char is_media_application[] = "isMediaApplication";
-const char greyOut[] = "greyOut";
-const char language_desired[] = "languageDesired";
-const char auto_activated_id[] = "autoActivateID";
-const char app_type[] = "appType";
-const char app_hmi_type[] = "appHMIType";
-const char tts_name[] = "ttsName";
-const char binary_data[] = "binary_data";
-const char timeout_prompt[] = "timeoutPrompt";
-const char timeout[] = "timeout";
-const char vr_help_title[] = "vrHelpTitle";
-const char vr_help[] = "vrHelp";
-const char main_field_1[] = "mainField1";
-const char main_field_2[] = "mainField2";
-const char main_field_3[] = "mainField3";
-const char main_field_4[] = "mainField4";
-const char eta[] = "eta";
-const char time_to_destination[] = "timeToDestination";
-const char total_distance[] = "totalDistance";
-const char alignment[] = "alignment";
-const char graphic[] = "graphic";
-const char secondary_graphic[] = "secondaryGraphic";
-const char status_bar[] = "statusBar";
-const char media_clock[] = "mediaClock";
-const char media_track[] = "mediaTrack";
-const char properties[] = "properties";
-const char cmd_id[] = "cmdID";
-const char menu_params[] = "menuParams";
-const char menu_title[] = "menuTitle";
-const char menu_icon[] = "menuIcon";
-const char keyboard_properties[] = "keyboardProperties";
-const char vr_commands[] = "vrCommands";
-const char position[] = "position";
-const char num_ticks[] = "numTicks";
-const char slider_footer[] = "sliderFooter";
-const char menu_id[] = "menuID";
-const char menu_name[] = "menuName";
-const char interaction_choice_set_id[] = "interactionChoiceSetID";
-const char interaction_choice_set_id_list[] = "interactionChoiceSetIDList";
-const char choice_set[] = "choiceSet";
-const char choice_id[] = "choiceID";
-const char grammar_id[] = "grammarID";
-const char navigation_text_1[] = "navigationText1";
-const char navigation_text_2[] = "navigationText2";
-const char alert_text1[] = "alertText1";
-const char alert_text2[] = "alertText2";
-const char alert_text3[] = "alertText3";
-const char tts_chunks[] = "ttsChunks";
-const char initial_prompt[] = "initialPrompt";
-const char initial_text[] = "initialText";
-const char duration[] = "duration";
-const char progress_indicator[] = "progressIndicator";
-const char alert_type[] = "alertType";
-const char play_tone[] = "playTone";
-const char soft_buttons[] = "softButtons";
-const char soft_button_id[] = "softButtonID";
-const char custom_presets[] = "customPresets";
-const char audio_pass_display_text1[] = "audioPassThruDisplayText1";
-const char audio_pass_display_text2[] = "audioPassThruDisplayText2";
-const char max_duration[] = "maxDuration";
-const char sampling_rate[] = "samplingRate";
-const char bits_per_sample[] = "bitsPerSample";
-const char audio_type[] = "audioType";
-const char mute_audio[] = "muteAudio";
-const char button_name[] = "buttonName";
-const char button_event_mode[] = "buttonEventMode";
-const char button_press_mode[] = "buttonPressMode";
-const char custom_button_id[] = "customButtonID";
-const char data_type[] = "dataType";
-const char turn_list[] = "turnList";
-const char turn_icon[] = "turnIcon";
-const char next_turn_icon[] = "nextTurnIcon";
-const char value[] = "value";
-const char hmi_display_language[] = "hmiDisplayLanguage";
-const char language[] = "language";
-const char data[] = "data";
-const char start_time[] = "startTime";
-const char end_time[] = "endTime";
-const char hours[] = "hours";
-const char minutes[] = "minutes";
-const char seconds [] = "seconds";
-const char update_mode[] = "updateMode";
-const char trigger_source[] = "triggerSource";
-const char hmi_level[] = "hmiLevel";
-const char activate_app_hmi_level[] = "level";
-const char audio_streaming_state[] = "audioStreamingState";
-const char system_context[] = "systemContext";
-const char speech_capabilities[] = "speechCapabilities";
-const char vr_capabilities[] = "vrCapabilities";
-const char audio_pass_thru_capabilities[] = "audioPassThruCapabilities";
+extern const char* params;
+extern const char* message_type;
+extern const char* correlation_id;
+extern const char* function_id;
+extern const char* protocol_version;
+extern const char* protocol_type;
+extern const char* connection_key;
+extern const char* error;
+extern const char* error_msg;
+extern const char* default_app_id;
+extern const char* msg_params;
+extern const char* method_name;
+extern const char* info;
+extern const char* app_id;
+extern const char* hmi_app_id;
+extern const char* device_id;
+extern const char* subscribed_for_way_points;
+extern const char* url;
+extern const char* urlScheme;
+extern const char* packageName;
+extern const char* cmd_icon;
+extern const char* result_code;
+extern const char* success;
+extern const char* sync_msg_version;
+extern const char* major_version;
+extern const char* minor_version;
+extern const char* app_name;
+extern const char* ngn_media_screen_app_name;
+extern const char* vr_synonyms;
+extern const char* uses_vehicle_data;
+extern const char* is_media_application;
+extern const char* greyOut;
+extern const char* language_desired;
+extern const char* auto_activated_id;
+extern const char* app_type;
+extern const char* app_hmi_type;
+extern const char* tts_name;
+extern const char* binary_data;
+extern const char* timeout_prompt;
+extern const char* timeout;
+extern const char* vr_help_title;
+extern const char* vr_help;
+extern const char* main_field_1;
+extern const char* main_field_2;
+extern const char* main_field_3;
+extern const char* main_field_4;
+extern const char* eta;
+extern const char* time_to_destination;
+extern const char* total_distance;
+extern const char* alignment;
+extern const char* graphic;
+extern const char* secondary_graphic;
+extern const char* status_bar;
+extern const char* media_clock;
+extern const char* media_track;
+extern const char* properties;
+extern const char* cmd_id;
+extern const char* menu_params;
+extern const char* menu_title;
+extern const char* menu_icon;
+extern const char* keyboard_properties;
+extern const char* vr_commands;
+extern const char* position;
+extern const char* num_ticks;
+extern const char* slider_footer;
+extern const char* menu_id;
+extern const char* menu_name;
+extern const char* interaction_choice_set_id;
+extern const char* interaction_choice_set_id_list;
+extern const char* choice_set;
+extern const char* choice_id;
+extern const char* grammar_id;
+extern const char* navigation_text_1;
+extern const char* navigation_text_2;
+extern const char* alert_text1;
+extern const char* alert_text2;
+extern const char* alert_text3;
+extern const char* tts_chunks;
+extern const char* initial_prompt;
+extern const char* initial_text;
+extern const char* duration;
+extern const char* progress_indicator;
+extern const char* alert_type;
+extern const char* play_tone;
+extern const char* soft_buttons;
+extern const char* soft_button_id;
+extern const char* custom_presets;
+extern const char* audio_pass_display_text1;
+extern const char* audio_pass_display_text2;
+extern const char* max_duration;
+extern const char* sampling_rate;
+extern const char* bits_per_sample;
+extern const char* audio_type;
+extern const char* mute_audio;
+extern const char* button_name;
+extern const char* button_event_mode;
+extern const char* button_press_mode;
+extern const char* custom_button_id;
+extern const char* data_type;
+extern const char* turn_list;
+extern const char* turn_icon;
+extern const char* next_turn_icon;
+extern const char* value;
+extern const char* hmi_display_language;
+extern const char* language;
+extern const char* data;
+extern const char* start_time;
+extern const char* end_time;
+extern const char* hours;
+extern const char* minutes;
+extern const char* seconds;
+extern const char* update_mode;
+extern const char* trigger_source;
+extern const char* hmi_level;
+extern const char* activate_app_hmi_level;
+extern const char* audio_streaming_state;
+extern const char* system_context;
+extern const char* speech_capabilities;
+extern const char* vr_capabilities;
+extern const char* audio_pass_thru_capabilities;
+extern const char* pcm_stream_capabilities;
+
// PutFile
-const char sync_file_name[] = "syncFileName";
-const char file_name[] = "fileName";
-const char file_type[] = "fileType";
-const char file_size[] = "fileSize";
-const char request_type[] = "requestType";
-const char persistent_file[] = "persistentFile";
-const char file_data[] = "fileData";
-const char space_available[] = "spaceAvailable";
-const char image_type[] = "imageType";
-const char image[] = "image";
-const char type[] = "type";
-const char system_file[] = "systemFile";
-const char offset[] = "offset";
-const char length[] = "length";
-const char secondary_image[] = "secondaryImage";
-const char filenames[] = "filenames";
+extern const char* sync_file_name;
+extern const char* file_name;
+extern const char* file_type;
+extern const char* file_size;
+extern const char* request_type;
+extern const char* persistent_file;
+extern const char* file_data;
+extern const char* space_available;
+extern const char* image_type;
+extern const char* image;
+extern const char* type;
+extern const char* system_file;
+extern const char* offset;
+extern const char* length;
+extern const char* secondary_image;
+extern const char* filenames;
-const char hmi_display_language_desired[] = "hmiDisplayLanguageDesired";
-const char ecu_name[] = "ecuName";
-const char dtc_mask[] = "dtcMask";
-const char did_location[] = "didLocation";
-const char app_list[] = "appList";
-const char device_list[] = "deviceList";
-const char device_info[] = "deviceInfo";
-const char name[] = "name";
-const char id[] = "id";
-const char isSDLAllowed[] = "isSDLAllowed";
-const char transport_type[] = "transportType";
-const char application[] = "application";
-const char applications[] = "applications";
-const char icon[] = "icon";
-const char device_name[] = "deviceName";
-const char reason[] = "reason";
-const char available[] = "available";
-const char text[] = "text";
-const char character_set[] = "characterSet";
-const char secondary_text[] = "secondaryText";
-const char tertiary_text[] = "tertiaryText";
-const char hardware[] = "hardware";
-const char firmware_rev[] = "firmwareRev";
-const char os[] = "os";
-const char os_version[] = "osVersion";
-const char carrier[] = "carrier";
-const char slider_header[] = "sliderHeader";
+extern const char* hmi_display_language_desired;
+extern const char* ecu_name;
+extern const char* dtc_mask;
+extern const char* did_location;
+extern const char* app_list;
+extern const char* device_list;
+extern const char* device_info;
+extern const char* name;
+extern const char* id;
+extern const char* isSDLAllowed;
+extern const char* transport_type;
+extern const char* application;
+extern const char* applications;
+extern const char* icon;
+extern const char* device_name;
+extern const char* reason;
+extern const char* available;
+extern const char* text;
+extern const char* character_set;
+extern const char* secondary_text;
+extern const char* tertiary_text;
+extern const char* hardware;
+extern const char* firmware_rev;
+extern const char* os;
+extern const char* os_version;
+extern const char* carrier;
+extern const char* slider_header;
+extern const char* key_press_mode;
// duplicate names from hmi_request
-const char limited_character_list[] = "limitedCharacterList";
-const char auto_complete_text[] = "autoCompleteText";
-const char navigation_text[] = "navigationText";
+extern const char* limited_character_list;
+extern const char* auto_complete_text;
+extern const char* navigation_text;
// vehicle info
-const char gps[] = "gps";
-const char speed[] = "speed";
-const char rpm[] = "rpm";
-const char fuel_level[] = "fuelLevel";
-const char fuel_level_state[] = "fuelLevel_State";
-const char instant_fuel_consumption[] = "instantFuelConsumption";
-const char external_temp[] = "externalTemperature";
-const char vin[] = "vin";
-const char prndl[] = "prndl";
-const char tire_pressure[] = "tirePressure";
-const char odometer[] = "odometer";
-const char belt_status[] = "beltStatus";
-const char body_information[] = "bodyInformation";
-const char device_status[] = "deviceStatus";
-const char driver_braking[] = "driverBraking";
-const char wiper_status[] = "wiperStatus";
-const char head_lamp_status[] = "headLampStatus";
-const char engine_torque[] = "engineTorque";
-const char acc_pedal_pos[] = "accPedalPosition";
-const char steering_wheel_angle[] = "steeringWheelAngle";
-const char e_call_info[] = "eCallInfo";
-const char airbag_status[] = "airbagStatus";
-const char emergency_event[] = "emergencyEvent";
-const char cluster_mode_status[] = "clusterModeStatus";
-const char my_key[] = "myKey";
-const char help_prompt[] = "helpPrompt";
-const char scroll_message_body[] = "scrollableMessageBody";
-const char data_result[] = "dataResult";
-const char dtc_list[] = "dtcList";
-const char interaction_mode[] = "interactionMode";
-const char slider_position[] = "sliderPosition";
-const char system_action[] = "systemAction";
-const char prerecorded_speech[] = "prerecordedSpeech";
-const char supported_diag_modes[] = "supportedDiagModes";
-const char hmi_capabilities[] = "hmiCapabilities";
-const char navigation[] = "navigation";
-const char phone_call[] = "phoneCall";
-const char sdl_version[] = "sdlVersion";
-const char system_software_version[] = "systemSoftwareVersion";
-const char priority[] = "priority";
+extern const char* gps;
+extern const char* speed;
+extern const char* rpm;
+extern const char* fuel_level;
+extern const char* fuel_level_state;
+extern const char* instant_fuel_consumption;
+extern const char* external_temp;
+extern const char* vin;
+extern const char* prndl;
+extern const char* tire_pressure;
+extern const char* odometer;
+extern const char* belt_status;
+extern const char* body_information;
+extern const char* device_status;
+extern const char* driver_braking;
+extern const char* wiper_status;
+extern const char* head_lamp_status;
+extern const char* engine_torque;
+extern const char* acc_pedal_pos;
+extern const char* steering_wheel_angle;
+extern const char* e_call_info;
+extern const char* airbag_status;
+extern const char* emergency_event;
+extern const char* cluster_mode_status;
+extern const char* my_key;
+extern const char* help_prompt;
+extern const char* scroll_message_body;
+extern const char* data_result;
+extern const char* dtc_list;
+extern const char* interaction_mode;
+extern const char* slider_position;
+extern const char* system_action;
+extern const char* prerecorded_speech;
+extern const char* supported_diag_modes;
+extern const char* hmi_capabilities;
+extern const char* navigation;
+extern const char* phone_call;
+extern const char* sdl_version;
+extern const char* system_software_version;
+extern const char* priority;
+
+// resuming
+extern const char* application_commands;
+extern const char* application_submenus;
+extern const char* application_choice_sets;
+extern const char* application_global_properties;
+extern const char* application_vehicle_info;
+extern const char* application_buttons;
+extern const char* application_subscribtions;
+extern const char* application_files;
+extern const char* application_show;
+extern const char* resumption;
+extern const char* resume_app_list;
+extern const char* last_ign_off_time;
+
+extern const char* resume_vr_grammars;
-//resuming
-const char application_commands[] = "applicationCommands";
-const char application_submenus[] = "applicationSubMenus";
-const char application_choise_sets[] = "applicationChoiceSets";
-const char application_global_properties[] = "globalProperties";
-const char application_vehicle_info[] = "vehicleInfo";
-const char application_buttons[] = "buttons";
-const char application_subscribtions[] = "subscribtions";
-const char application_files[] = "applicationFiles";
-const char application_show[] = "applicationShow";
-const char resumption[] = "resumption";
-const char resume_app_list[] = "resume_app_list";
-const char last_ign_off_time[] = "last_ign_off_time";
+extern const char* ign_off_count;
-const char resume_vr_grammars[] = "resumeVrGrammars";
+extern const char* connection_info;
+extern const char* is_download_complete;
-const char ign_off_count[] = "ign_off_count";
-const char suspend_count[] = "suspend_count";
+extern const char* longitude_degrees;
+extern const char* latitude_degrees;
+extern const char* address;
+extern const char* country_name;
+extern const char* country_code;
+extern const char* postal_code;
+extern const char* administrative_area;
+extern const char* locality;
+extern const char* sub_locality;
+extern const char* thoroughfare;
+extern const char* sub_thoroughfare;
-const char connection_info[] = "connection_info";
-const char is_download_complete[] = "is_download_complete";
+extern const char* hash_id;
+extern const char* time_stamp;
+extern const char* manual_text_entry;
+extern const char* image_type_supported;
+extern const char* unexpected_disconnect;
+extern const char* location_name;
+extern const char* location_description;
+extern const char* address_lines;
+extern const char* phone_number;
+extern const char* number;
+extern const char* location_image;
+extern const char* is_suscribed;
+extern const char* message_data;
-const char hash_id[] = "hashID";
-const char time_stamp[] = "timeStamp";
-const char manual_text_entry[] = "manualTextEntry";
-const char image_type_supported[] = "imageTypeSupported";
-const char unexpected_disconnect[] = "unexpectedDisconnect";
-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";
+extern const char* delivery_mode;
} // namespace strings
namespace json {
-const char appId[] = "appId";
-const char name[] = "name";
-const char ios[] = "ios";
-const char android[] = "android";
-const char appHmiType[] = "appHmiType";
-const char urlScheme[] = "urlScheme";
-const char packageName[] = "packageName";
-const char response[] = "response";
-const char is_media_application[] = "isMediaApplication";
-const char default_[] = "default";
-const char languages[] = "languages";
-const char ttsName[] = "ttsName";
-const char vrSynonyms[] = "vrSynonyms";
-} // namespace json
+extern const char* appId;
+extern const char* name;
+extern const char* ios;
+extern const char* android;
+extern const char* appHmiType;
+extern const char* urlScheme;
+extern const char* packageName;
+extern const char* response;
+extern const char* is_media_application;
+extern const char* default_;
+extern const char* languages;
+extern const char* ttsName;
+extern const char* vrSynonyms;
+} // namespace json
namespace http_request {
-const char httpRequest[] = "HTTPRequest";
-const char headers[] = "headers";
-const char content_type[] = "ContentType";
-const char connect_timeout[] = "ConnectTimout";
-const char do_output[] = "DoOutput";
-const char do_input[] = "DoInput";
-const char use_caches[] = "UseCaches";
-const char request_method[] = "RequestMethod";
-const char read_timeout[] = "ReadTimeout";
-const char instance_follow_redirect[] = "InstanceFollowRedirect";
-const char charset[] = "charset";
-const char content_lenght[] = "Content_Lenght";
-const char GET[] = "GET";
-} // http_request
+extern const char* httpRequest;
+extern const char* headers;
+extern const char* content_type;
+extern const char* connect_timeout;
+extern const char* do_output;
+extern const char* do_input;
+extern const char* use_caches;
+extern const char* request_method;
+extern const char* read_timeout;
+extern const char* instance_follow_redirect;
+extern const char* charset;
+extern const char* content_lenght;
+extern const char* GET;
+} // http_request
namespace mobile_notification {
-const char state[] = "state";
-const char syncp_timeout[] = "Timeout";
-const char syncp_url[] = "URL";
+extern const char* state;
+extern const char* syncp_timeout;
+extern const char* syncp_url;
} // namespace mobile_notification
namespace hmi_levels {
-const char kFull[] = "FULL";
-const char kLimited[] = "LIMITED";
-const char kBackground[] = "BACKGROUND";
-const char kNone[] = "NONE";
+extern const char* kFull;
+extern const char* kLimited;
+extern const char* kBackground;
+extern const char* kNone;
}
namespace hmi_request {
-const char parent_id[] = "parentID";
-const char field_name[] = "fieldName";
-const char field_text[] = "fieldText";
-const char alert_strings[] = "alertStrings";
-const char duration[] = "duration";
-const char soft_buttons[] = "softButtons";
-const char tts_chunks[] = "ttsChunks";
-const char speak_type[] = "speakType";
-const char audio_pass_display_texts[] = "audioPassThruDisplayTexts";
-const char max_duration[] = "maxDuration";
-const char reason[] = "reason";
-const char message_text[] = "messageText";
-const char initial_text[] = "initialText";
-const char navi_texts[] = "navigationTexts";
-const char navi_text[] = "navigationText";
-const char show_strings[] = "showStrings";
-const char interaction_layout[] = "interactionLayout";
-const char menu_title[] = "menuTitle";
-const char menu_icon[] = "menuIcon";
-const char keyboard_properties[] = "keyboardProperties";
-const char method_name[] = "methodName";
-const char keyboard_layout[] = "keyboardLayout";
-const char limited_character_list[] = "limitedCharacterList";
-const char auto_complete_text[] = "autoCompleteText";
-const char file[] = "file";
-const char retry[] = "retry";
-const char service[] = "service";
+extern const char* parent_id;
+extern const char* field_name;
+extern const char* field_text;
+extern const char* alert_strings;
+extern const char* duration;
+extern const char* soft_buttons;
+extern const char* tts_chunks;
+extern const char* speak_type;
+extern const char* audio_pass_display_texts;
+extern const char* max_duration;
+extern const char* reason;
+extern const char* message_text;
+extern const char* initial_text;
+extern const char* navi_texts;
+extern const char* navi_text;
+extern const char* show_strings;
+extern const char* interaction_layout;
+extern const char* menu_title;
+extern const char* menu_icon;
+extern const char* keyboard_properties;
+extern const char* method_name;
+extern const char* keyboard_layout;
+extern const char* limited_character_list;
+extern const char* auto_complete_text;
+extern const char* file;
+extern const char* retry;
+extern const char* service;
} // namespace hmi_request
namespace hmi_response {
-const char code[] = "code";
-const char message[] = "message";
-const char method[] = "method";
-const char try_again_time[] = "tryAgainTime";
-const char custom_button_id[] = "customButtonID";
-const char button_name[] = "name";
-const char button_mode[] = "mode";
-const char attenuated_supported[] = "attenuatedSupported";
-const char languages[] = "languages";
-const char language[] = "language";
-const char display_capabilities[] = "displayCapabilities";
-const char hmi_zone_capabilities[] = "hmiZoneCapabilities";
-const char soft_button_capabilities[] = "softButtonCapabilities";
-const char image_supported[] = "imageSupported";
-const char button_capabilities[] = "buttonCapabilities";
-const char capabilities[] = "capabilities";
-const char speech_capabilities[] = "speechCapabilities";
-const char prerecorded_speech_capabilities[] = "prerecordedSpeechCapabilities";
-const char preset_bank_capabilities[] = "presetBankCapabilities";
-const char allowed[] = "allowed";
-const char vehicle_type[] = "vehicleType";
-const char did_result[] = "didResult";
-const char result_code[] = "resultCode";
-const char dtc[] = "dtc";
-const char ecu_header[] = "ecuHeader";
-const char image_capabilities[] = "imageCapabilities";
-const char display_type[] = "displayType";
-const char text_fields[] = "textFields";
-const char media_clock_formats[] = "mediaClockFormats";
-const char graphic_supported[] = "graphicSupported";
-const char image_fields[] = "imageFields";
-const char templates_available[] = "templatesAvailable";
-const char screen_params[] = "screenParams";
-const char num_custom_presets_available[] = "numCustomPresetsAvailable";
-const char urls[] = "urls";
-const char policy_app_id[] = "policyAppID";
-const char enabled[] = "enabled";
+extern const char* code;
+extern const char* message;
+extern const char* method;
+extern const char* try_again_time;
+extern const char* custom_button_id;
+extern const char* button_name;
+extern const char* button_mode;
+extern const char* attenuated_supported;
+extern const char* languages;
+extern const char* language;
+extern const char* display_capabilities;
+extern const char* hmi_zone_capabilities;
+extern const char* soft_button_capabilities;
+extern const char* image_supported;
+extern const char* button_capabilities;
+extern const char* capabilities;
+extern const char* speech_capabilities;
+extern const char* prerecorded_speech_capabilities;
+extern const char* preset_bank_capabilities;
+extern const char* allowed;
+extern const char* vehicle_type;
+extern const char* did_result;
+extern const char* result_code;
+extern const char* dtc;
+extern const char* ecu_header;
+extern const char* image_capabilities;
+extern const char* display_type;
+extern const char* text_fields;
+extern const char* media_clock_formats;
+extern const char* graphic_supported;
+extern const char* image_fields;
+extern const char* templates_available;
+extern const char* screen_params;
+extern const char* num_custom_presets_available;
+extern const char* urls;
+extern const char* policy_app_id;
+extern const char* enabled;
} // namespace hmi_response
namespace hmi_notification {
-const char prndl[] = "prndl";
-const char file_name[] = "file_name";
-const char system_context[] = "systemContext";
-const char state[] = "state";
-const char result[] = "result";
-const char statistic_type[] = "statisticType";
-const char error[] = "error";
-const char policyfile[] = "policyfile";
-const char is_active[] = "isActive";
+extern const char* prndl;
+extern const char* file_name;
+extern const char* system_context;
+extern const char* state;
+extern const char* result;
+extern const char* statistic_type;
+extern const char* error;
+extern const char* policyfile;
+extern const char* is_active;
+extern const char* is_deactivated;
+extern const char* event_name;
} // 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
deleted file mode 100644
index 94962c23b4..0000000000
--- a/src/components/application_manager/include/application_manager/state_context.h
+++ /dev/null
@@ -1,75 +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_APPLICATION_MANAGER_STATE_CONTEXT_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTEXT_H_
-
-#include <inttypes.h>
-
-namespace application_manager {
-/**
-* @brief The StateContext implement acessing to data, that is required by HmiState
-*/
-class StateContext {
- public:
-
- /**
- * @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_meida_app check if app is is meida
- * @param app_id application id
- * @return @return true if meida_app, otherwise return false
- */
- bool is_meida_app(const uint32_t app_id) const;
-
- /**
- * @brief is_voice_comunication_app check if app is voice comunication
- * @param app_id application id
- * @return @return true if voice_comunication_app, otherwise return false
- */
- bool is_voice_comunication_app(const uint32_t app_id) const;
-
- /**
- * @brief is_attenuated_supported check if HMI support attenuated mode
- * @return true if supported, otherwise return false
- */
- bool is_attenuated_supported() const;
-};
-
-}
-#endif // STATE_CONTEXT_H
-
diff --git a/src/components/application_manager/include/application_manager/state_controller.h b/src/components/application_manager/include/application_manager/state_controller.h
deleted file mode 100644
index 6d5946124b..0000000000
--- a/src/components/application_manager/include/application_manager/state_controller.h
+++ /dev/null
@@ -1,408 +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_APPLICATION_MANAGER_STATE_CONTROLLER_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
-#include <list>
-
-#include "application_manager/hmi_state.h"
-#include "application_manager/application.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"
-
-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);
-
- 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);
- }
- }
-
- /**
- * @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);
- }
-
- /**
- * @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) {
- 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);
- }
-
- /**
- * @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);
- }
-
- /**
- * @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);
- }
-
- // 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 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_; }
-
- /**
- * @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()));
- }
- }
- }
-
- /**
- * @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);
- };
-
- /**
- * 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);
-
- /**
- * 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
- * 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);
-
- mobile_apis::AudioStreamingState::eType
- CalcAudioState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level) const;
-
- 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_;
-};
-}
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
new file mode 100644
index 0000000000..f2f9fb39a4
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -0,0 +1,448 @@
+/*
+ * 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_STATE_CONTROLLER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_IMPL_H_
+#include <list>
+
+#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/state_controller.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/lock.h"
+#include "utils/helpers.h"
+
+namespace application_manager {
+
+class StateControllerImpl : public event_engine::EventObserver,
+ public StateController {
+ public:
+ explicit StateControllerImpl(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
+ */
+
+ virtual void SetRegularState(ApplicationSharedPtr app,
+ HmiStatePtr state,
+ const bool SendActivateApp);
+
+ /**
+ * @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 */
+
+ virtual void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const bool SendActivateApp);
+
+ /**
+ * @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
+ */
+ virtual void SetRegularState(ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const bool SendActivateApp);
+
+ /**
+ * @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 */
+
+ virtual 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,
+ const bool SendActivateApp);
+
+ /**
+ * @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
+ */
+ virtual void SetRegularState(ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level);
+
+ /**
+ * @brief SetRegularState Change regular audio state
+ * @param app appication to setup regular State
+ * @param audio_state of new regular state
+ */
+ virtual void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::AudioStreamingState::eType audio_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);
+
+ /**
+ * @brief SetRegularState Sets new regular state to application
+ * @param app appication to setup regular state
+ * @param state new hmi state for application
+ */
+ virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr 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
+ */
+ virtual 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.
+ */
+ virtual 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_;
+ StateControllerImpl* state_ctrl_;
+ HmiLevelConflictResolver(ApplicationSharedPtr app,
+ HmiStatePtr state,
+ StateControllerImpl* 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 StateControllerImpl collection
+ * @param ID state identifier
+ */
+ void TempStateStarted(HmiState::StateID ID);
+
+ /**
+ * @brief TempStateStopped remove HMI State ID from StateControllerImpl
+ * 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(&StateControllerImpl::HMIStateStarted<ID>), this));
+ TempStateStarted(ID);
+ }
+
+ /**
+ * @brief Cancel temporary state
+ */
+ template <HmiState::StateID ID>
+ void CancelTempState() {
+ ForEachApplication(std::bind1st(
+ std::mem_fun(&StateControllerImpl::HMIStateStopped<ID>), this));
+ TempStateStopped(ID);
+ }
+
+ /**
+ * @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_IMPL_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..ab995fcf91 100644
--- a/src/components/application_manager/include/application_manager/time_metric_observer.h
+++ b/src/components/application_manager/include/application_manager/telemetry_observer.h
@@ -33,7 +33,6 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TIME_METRIC_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TIME_METRIC_OBSERVER_H_
-
#include "smart_objects/smart_object.h"
#include "application_manager/smart_object_keys.h"
#include "json/json.h"
@@ -43,7 +42,7 @@
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
namespace application_manager {
-class AMMetricObserver {
+class AMTelemetryObserver {
public:
struct MessageMetric {
TimevalStruct begin;
@@ -53,7 +52,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..b84c820a60 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 "usage_statistics/counter.h"
+#include <memory>
+#include "policy/usage_statistics/counter.h"
+#include "policy/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/include/application_manager/vehicle_info_data.h b/src/components/application_manager/include/application_manager/vehicle_info_data.h
index 0cac4fd8f9..390a1707c8 100644
--- a/src/components/application_manager/include/application_manager/vehicle_info_data.h
+++ b/src/components/application_manager/include/application_manager/vehicle_info_data.h
@@ -34,10 +34,10 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_
namespace application_manager {
- /*
- * @brief Typedef for the vehicle data types that can
- * be published and subscribed to
- */
+/*
+*@brief Typedef for the vehicle data types that can
+*be published and subscribed to
+*/
enum VehicleDataType {
GPS = 0,
SPEED,
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index bfdbadfc8f..a81540708c 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -37,16 +37,15 @@
#include "utils/logger.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationDataImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
InitialApplicationDataImpl::InitialApplicationDataImpl()
- : app_types_(NULL),
- vr_synonyms_(NULL),
- tts_name_(NULL),
- ngn_media_screen_name_(NULL),
- language_(mobile_api::Language::INVALID_ENUM),
- ui_language_(mobile_api::Language::INVALID_ENUM) {
-}
+ : app_types_(NULL)
+ , vr_synonyms_(NULL)
+ , tts_name_(NULL)
+ , ngn_media_screen_name_(NULL)
+ , language_(mobile_api::Language::INVALID_ENUM)
+ , ui_language_(mobile_api::Language::INVALID_ENUM) {}
InitialApplicationDataImpl::~InitialApplicationDataImpl() {
if (app_types_) {
@@ -70,17 +69,17 @@ InitialApplicationDataImpl::~InitialApplicationDataImpl() {
}
}
-const smart_objects::SmartObject*
-InitialApplicationDataImpl::app_types() const {
+const smart_objects::SmartObject* InitialApplicationDataImpl::app_types()
+ const {
return app_types_;
}
-const smart_objects::SmartObject*
-InitialApplicationDataImpl::vr_synonyms() const {
+const smart_objects::SmartObject* InitialApplicationDataImpl::vr_synonyms()
+ const {
return vr_synonyms_;
}
-std::string InitialApplicationDataImpl::mobile_app_id() const {
+std::string InitialApplicationDataImpl::policy_app_id() const {
return mobile_app_id_;
}
@@ -93,13 +92,13 @@ InitialApplicationDataImpl::ngn_media_screen_name() const {
return ngn_media_screen_name_;
}
-const mobile_api::Language::eType&
-InitialApplicationDataImpl::language() const {
+const mobile_api::Language::eType& InitialApplicationDataImpl::language()
+ const {
return language_;
}
-const mobile_api::Language::eType&
-InitialApplicationDataImpl::ui_language() const {
+const mobile_api::Language::eType& InitialApplicationDataImpl::ui_language()
+ const {
return ui_language_;
}
@@ -153,28 +152,37 @@ void InitialApplicationDataImpl::set_ui_language(
ui_language_ = ui_language;
}
-DynamicApplicationDataImpl::DynamicApplicationDataImpl()
- : help_prompt_(NULL),
- timeout_prompt_(NULL),
- vr_help_title_(NULL),
- vr_help_(NULL),
- tbt_state_(mobile_api::TBTState::INVALID_ENUM),
- show_command_(NULL),
- keyboard_props_(NULL),
- menu_title_(NULL),
- menu_icon_(NULL),
- tbt_show_command_(NULL),
- commands_(),
- commands_lock_(true),
- sub_menu_(),
- choice_set_map_(),
- performinteraction_choice_set_map_(),
- performinteraction_choice_set_lock_(true),
- is_perform_interaction_active_(false),
- is_reset_global_properties_active_(false),
- perform_interaction_mode_(-1) {
+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)
+ , vr_help_title_(NULL)
+ , vr_help_(NULL)
+ , tbt_state_(mobile_api::TBTState::INVALID_ENUM)
+ , show_command_(NULL)
+ , keyboard_props_(NULL)
+ , menu_title_(NULL)
+ , menu_icon_(NULL)
+ , tbt_show_command_(NULL)
+ , commands_()
+ , commands_lock_(true)
+ , sub_menu_()
+ , choice_set_map_()
+ , performinteraction_choice_set_map_()
+ , performinteraction_choice_set_lock_(true)
+ , is_perform_interaction_active_(false)
+ , is_reset_global_properties_active_(false)
+ , perform_interaction_mode_(-1) {}
+
DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
if (help_prompt_) {
delete help_prompt_;
@@ -207,82 +215,88 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
}
for (CommandsMap::iterator command_it = commands_.begin();
- commands_.end() != command_it; ++command_it) {
+ commands_.end() != command_it;
+ ++command_it) {
delete command_it->second;
}
commands_.clear();
for (SubMenuMap::iterator sub_menu_it = sub_menu_.begin();
- sub_menu_.end() != sub_menu_it; ++sub_menu_it) {
+ sub_menu_.end() != sub_menu_it;
+ ++sub_menu_it) {
delete sub_menu_it->second;
}
sub_menu_.clear();
PerformChoiceSetMap::iterator it = performinteraction_choice_set_map_.begin();
for (; performinteraction_choice_set_map_.end() != it; ++it) {
- PerformChoice::iterator choice_it = performinteraction_choice_set_map_[it->first].begin();
- for (; performinteraction_choice_set_map_[it->first].end() != choice_it; ++choice_it) {
- delete choice_it->second;
+ PerformChoice::iterator choice_it =
+ performinteraction_choice_set_map_[it->first].begin();
+ for (; performinteraction_choice_set_map_[it->first].end() != choice_it;
+ ++choice_it) {
+ delete choice_it->second;
}
performinteraction_choice_set_map_[it->first].clear();
}
performinteraction_choice_set_map_.clear();
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::help_prompt() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::help_prompt()
+ const {
return help_prompt_;
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::timeout_prompt() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::timeout_prompt()
+ const {
return timeout_prompt_;
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::vr_help_title() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::vr_help_title()
+ const {
return vr_help_title_;
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::vr_help() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::vr_help() const {
return vr_help_;
}
-const mobile_api::TBTState::eType&
-DynamicApplicationDataImpl::tbt_state() const {
+const mobile_api::TBTState::eType& DynamicApplicationDataImpl::tbt_state()
+ const {
return tbt_state_;
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::show_command() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::show_command()
+ const {
return show_command_;
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::tbt_show_command() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::tbt_show_command()
+ const {
return tbt_show_command_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::keyboard_props() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::keyboard_props()
+ const {
return keyboard_props_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_title() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_title()
+ const {
return menu_title_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon()
+ const {
return menu_icon_;
}
void DynamicApplicationDataImpl::load_global_properties(
const smart_objects::SmartObject& properties_so) {
SetGlobalProperties(properties_so.getElement(strings::vr_help_title),
- &DynamicApplicationData::set_vr_help_title);
+ &DynamicApplicationData::set_vr_help_title);
SetGlobalProperties(properties_so.getElement(strings::vr_help),
- &DynamicApplicationData::set_vr_help);
+ &DynamicApplicationData::set_vr_help);
SetGlobalProperties(properties_so.getElement(strings::timeout_prompt),
&DynamicApplicationData::set_timeout_prompt);
@@ -388,16 +402,15 @@ void DynamicApplicationDataImpl::set_menu_icon(
if (menu_icon_) {
delete menu_icon_;
}
- menu_icon_= new smart_objects::SmartObject(menu_icon);
+ menu_icon_ = new smart_objects::SmartObject(menu_icon);
}
void DynamicApplicationDataImpl::SetGlobalProperties(
const smart_objects::SmartObject& param,
void (DynamicApplicationData::*callback)(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject&)) {
-
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject&)) {
smart_objects::SmartType so_type = param.getType();
- if (so_type != smart_objects::SmartType::SmartType_Invalid &&
+ if (so_type != smart_objects::SmartType::SmartType_Invalid &&
so_type != smart_objects::SmartType::SmartType_Null) {
if (callback) {
(this->*callback)(param);
@@ -408,7 +421,7 @@ void DynamicApplicationDataImpl::SetGlobalProperties(
}
void DynamicApplicationDataImpl::AddCommand(
- uint32_t cmd_id, const smart_objects::SmartObject& command) {
+ uint32_t cmd_id, const smart_objects::SmartObject& command) {
sync_primitives::AutoLock lock(commands_lock_);
CommandsMap::const_iterator it = commands_.find(cmd_id);
if (commands_.end() == it) {
@@ -438,7 +451,7 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand(
// TODO(VS): Create common functions for processing collections
void DynamicApplicationDataImpl::AddSubMenu(
- uint32_t menu_id, const smart_objects::SmartObject& menu) {
+ uint32_t menu_id, const smart_objects::SmartObject& menu) {
sync_primitives::AutoLock lock(sub_menu_lock_);
SubMenuMap::const_iterator it = sub_menu_.find(menu_id);
if (sub_menu_.end() == it) {
@@ -470,8 +483,7 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu(
bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
const std::string& name) {
sync_primitives::AutoLock lock(sub_menu_lock_);
- for (SubMenuMap::iterator it = sub_menu_.begin();
- sub_menu_.end() != it;
+ for (SubMenuMap::iterator it = sub_menu_.begin(); sub_menu_.end() != it;
++it) {
smart_objects::SmartObject* menu = it->second;
if ((*menu)[strings::menu_name] == name) {
@@ -482,7 +494,7 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
}
void DynamicApplicationDataImpl::AddChoiceSet(
- uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
+ uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
sync_primitives::AutoLock lock(choice_set_map_lock_);
ChoiceSetMap::const_iterator it = choice_set_map_.find(choice_set_id);
if (choice_set_map_.end() == it) {
@@ -512,15 +524,16 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindChoiceSet(
}
void DynamicApplicationDataImpl::AddPerformInteractionChoiceSet(
- uint32_t correlation_id, uint32_t choice_set_id,
- const smart_objects::SmartObject& vr_commands) {
+ uint32_t correlation_id,
+ uint32_t choice_set_id,
+ const smart_objects::SmartObject& vr_commands) {
sync_primitives::AutoLock lock(performinteraction_choice_set_lock_);
- performinteraction_choice_set_map_[correlation_id].insert(
- std::make_pair(choice_set_id, new smart_objects::SmartObject(vr_commands)));
+ performinteraction_choice_set_map_[correlation_id].insert(std::make_pair(
+ choice_set_id, new smart_objects::SmartObject(vr_commands)));
}
void DynamicApplicationDataImpl::DeletePerformInteractionChoiceSet(
- uint32_t correlation_id) {
+ uint32_t correlation_id) {
sync_primitives::AutoLock lock(performinteraction_choice_set_lock_);
PerformChoice::iterator it =
performinteraction_choice_set_map_[correlation_id].begin();
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 59b3830447..61451e3602 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.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,17 +30,20 @@
* 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"
+#include "application_manager/application_manager.h"
#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
#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"
+#include "application_manager/policies/policy_handler_interface.h"
namespace {
@@ -55,14 +58,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 +71,59 @@ mobile_apis::FileType::eType StringToFileType(const char* str) {
}
}
-namespace application_manager {
-
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-ApplicationImpl::ApplicationImpl(uint32_t application_id,
+namespace application_manager {
+
+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};
+ const std::string& mac_address,
+ const custom_str::CustomString& app_name,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ ApplicationManager& application_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_foreground_(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))
+ , application_manager_(application_manager) {
+ 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);
@@ -117,29 +131,19 @@ ApplicationImpl::ApplicationImpl(uint32_t application_id,
MarkUnregistered();
// subscribe application to custom button by default
SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON);
-
// 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);
+ HmiStatePtr initial_state = application_manager_.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;
+ application_manager_.get_settings().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));
+ application_manager_.get_settings().audio_data_stopped_timeout();
}
ApplicationImpl::~ApplicationImpl() {
@@ -187,7 +191,6 @@ void ApplicationImpl::ChangeSupportingAppHMIType() {
}
}
-
void ApplicationImpl::set_is_navi(bool allow) {
is_navi_ = allow;
}
@@ -202,74 +205,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{
- //sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- return hmi_states_.front();
+const HmiStatePtr ApplicationImpl::RegularHmiState() const {
+ return state_.GetState(HmiState::STATE_ID_REGULAR);
+}
+
+const HmiStatePtr ApplicationImpl::PostponedHmiState() const {
+ return state_.GetState(HmiState::STATE_ID_POSTPONED);
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -284,12 +265,16 @@ 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 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 {
@@ -302,11 +287,11 @@ const mobile_api::HMILevel::eType ApplicationImpl::hmi_level() const {
return hmi_state ? hmi_state->hmi_level() : HMILevel::INVALID_ENUM;
}
-bool application_manager::ApplicationImpl::is_foreground() const {
+bool ApplicationImpl::is_foreground() const {
return is_foreground_;
}
-void application_manager::ApplicationImpl::set_foreground(bool is_foreground) {
+void ApplicationImpl::set_foreground(const bool is_foreground) {
is_foreground_ = is_foreground;
}
@@ -322,12 +307,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 +322,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 +339,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 +350,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 +396,36 @@ void ApplicationImpl::StartStreaming(
LOG4CXX_AUTO_TRACE(logger_);
if (ServiceType::kMobileNav == service_type) {
+ LOG4CXX_TRACE(logger_, "ServiceType = Video");
if (!video_streaming_approved()) {
- MessageHelper::SendNaviStartStream(app_id());
+ LOG4CXX_TRACE(logger_, "Video streaming not approved");
+ MessageHelper::SendNaviStartStream(app_id(), application_manager_);
set_video_stream_retry_number(0);
}
} else if (ServiceType::kAudio == service_type) {
+ LOG4CXX_TRACE(logger_, "ServiceType = Audio");
if (!audio_streaming_approved()) {
- MessageHelper::SendAudioStartStream(app_id());
- set_video_stream_retry_number(0);
+ LOG4CXX_TRACE(logger_, "Audio streaming not approved");
+ MessageHelper::SendAudioStartStream(app_id(), application_manager_);
+ 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,40 +433,47 @@ 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(), application_manager_);
+ 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(), application_manager_);
+ 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();
- ApplicationManagerImpl::instance()->OnAppStreaming(
- app_id(), service_type, false);
+ video_stream_suspend_timer_.Stop();
+ application_manager_.OnAppStreaming(app_id(), service_type, false);
sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
video_streaming_suspended_ = true;
} else if (ServiceType::kAudio == service_type) {
- audio_stream_suspend_timer_->suspend();
- ApplicationManagerImpl::instance()->OnAppStreaming(
- app_id(), service_type, false);
+ audio_stream_suspend_timer_.Stop();
+ application_manager_.OnAppStreaming(app_id(), service_type, false);
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
audio_streaming_suspended_ = true;
}
- MessageHelper::SendOnDataStreaming(service_type, false);
+ MessageHelper::SendOnDataStreaming(service_type, false, application_manager_);
}
void ApplicationImpl::WakeUpStreaming(
@@ -480,21 +484,21 @@ void ApplicationImpl::WakeUpStreaming(
if (ServiceType::kMobileNav == service_type) {
sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
if (video_streaming_suspended_) {
- ApplicationManagerImpl::instance()->OnAppStreaming(
- app_id(), service_type, true);
- MessageHelper::SendOnDataStreaming(ServiceType::kMobileNav, true);
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
+ MessageHelper::SendOnDataStreaming(
+ ServiceType::kMobileNav, true, application_manager_);
video_streaming_suspended_ = false;
}
- video_stream_suspend_timer_->start(video_stream_suspend_timeout_);
+ video_stream_suspend_timer_.Start(video_stream_suspend_timeout_, false);
} else if (ServiceType::kAudio == service_type) {
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
if (audio_streaming_suspended_) {
- ApplicationManagerImpl::instance()->OnAppStreaming(
- app_id(), service_type, true);
- MessageHelper::SendOnDataStreaming(ServiceType::kAudio, true);
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
+ MessageHelper::SendOnDataStreaming(
+ ServiceType::kAudio, true, application_manager_);
audio_streaming_suspended_ = false;
}
- audio_stream_suspend_timer_->start(audio_stream_suspend_timeout_);
+ audio_stream_suspend_timer_.Start(audio_stream_suspend_timeout_, false);
}
}
@@ -550,7 +554,7 @@ bool ApplicationImpl::set_app_icon_path(const std::string& path) {
return false;
}
-void ApplicationImpl::set_app_allowed(const bool& allowed) {
+void ApplicationImpl::set_app_allowed(const bool allowed) {
is_app_allowed_ = allowed;
}
@@ -567,9 +571,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 +594,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 +627,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 +641,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,127 +689,144 @@ 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 =
+ application_manager_.get_settings().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 =
+ application_manager_.get_settings().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: {
+ const policy::PolicyHandlerInterface& policy_handler =
+ application_manager_.GetPolicyHandler();
+ std::string priority;
+ policy_handler.GetPriority(policy_app_id(), &priority);
+ uint32_t cmd_limit = policy_handler.GetNotificationsNumber(priority);
+
+ 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());
- MessageHelper::SendHashUpdateNotification(app_id());
+ hash_val_ =
+ utils::gen_hash(application_manager_.get_settings().hash_string_size());
+ set_is_application_data_changed(true);
+
+ MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
}
void ApplicationImpl::CleanupFiles() {
std::string directory_name =
- profile::Profile::instance()->app_storage_folder();
+ application_manager_.get_settings().app_storage_folder();
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 +838,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);
}
}
@@ -817,7 +851,8 @@ void ApplicationImpl::LoadPersistentFiles() {
using namespace profile;
if (kWaitingForRegistration == app_state_) {
- const std::string app_icon_dir(Profile::instance()->app_icons_folder());
+ const std::string app_icon_dir(
+ application_manager_.get_settings().app_icons_folder());
const std::string full_icon_path(app_icon_dir + "/" + mobile_app_id_);
if (file_system::FileExists(full_icon_path)) {
AppFile file;
@@ -830,7 +865,8 @@ void ApplicationImpl::LoadPersistentFiles() {
return;
}
- std::string directory_name = Profile::instance()->app_storage_folder();
+ std::string directory_name =
+ application_manager_.get_settings().app_storage_folder();
directory_name += "/" + folder_name();
if (file_system::DirectoryExists(directory_name)) {
@@ -853,17 +889,46 @@ 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) {
+uint32_t ApplicationImpl::GetAvailableDiskSpace() {
+ const uint32_t app_quota =
+ application_manager_.get_settings().app_dir_quota();
+ std::string app_storage_path =
+ application_manager_.get_settings().app_storage_folder();
+
+ app_storage_path += "/";
+ app_storage_path += folder_name();
+
+ if (file_system::DirectoryExists(app_storage_path)) {
+ size_t size_of_directory = file_system::DirectorySize(app_storage_path);
+ if (app_quota < size_of_directory) {
+ return 0;
+ }
+
+ uint32_t current_app_quota = app_quota - size_of_directory;
+ uint32_t available_disk_space =
+ file_system::GetAvailableDiskSpace(app_storage_path);
+
+ if (current_app_quota > available_disk_space) {
+ return available_disk_space;
+ }
+ return current_app_quota;
+ }
+ return app_quota;
+}
+
+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 +942,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 +952,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 626cc4fc0e..8cf09412f3 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
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdlib.h> // for rand()
+#include <stdlib.h> // for rand()
#include <climits>
#include <string>
@@ -48,16 +48,20 @@
#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 "config_profile/profile.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/CFormatterJsonSDLRPCv1.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"
-#include "usage_statistics/counter.h"
+#include "media_manager/media_manager.h"
+#include "policy/usage_statistics/counter.h"
+#include "utils/custom_string.h"
#include <time.h>
namespace {
@@ -68,7 +72,16 @@ int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
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;
@@ -78,34 +91,50 @@ 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) {
-
+ApplicationManagerImpl::ApplicationManagerImpl(
+ const ApplicationManagerSettings& am_settings,
+ const policy::PolicySettings& policy_settings)
+ : settings_(am_settings)
+ , 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)
+ , policy_handler_(policy_settings, *this)
+ , protocol_handler_(NULL)
+ , request_ctrl_(am_settings)
+ , 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_(am_settings.stop_streaming_timeout())
+ , navi_end_stream_timeout_(am_settings.stop_streaming_timeout())
+ , stopping_application_mng_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);
@@ -114,16 +143,17 @@ ApplicationManagerImpl::ApplicationManagerImpl()
{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);
+ 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, false);
+ timer_pool_.push_back(clearing_timer);
}
ApplicationManagerImpl::~ApplicationManagerImpl() {
- LOG4CXX_INFO(logger_, "Destructing ApplicationManager.");
+ LOG4CXX_AUTO_TRACE(logger_);
is_stopping_ = true;
SendOnSDLClose();
@@ -139,10 +169,8 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
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();
sync_primitives::AutoLock lock(timer_pool_lock_);
timer_pool_.clear();
@@ -151,54 +179,57 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
navi_app_to_end_stream_.clear();
}
-bool ApplicationManagerImpl::Stop() {
- LOG4CXX_INFO(logger_, "Stop ApplicationManager.");
- stopping_flag_lock_.Acquire();
- is_stopping_ = true;
- stopping_flag_lock_.Release();
- application_list_update_timer_->stop();
- try {
- UnregisterAllApplications();
- } catch (...) {
- LOG4CXX_ERROR(logger_,
- "An error occurred during unregistering applications.");
+template <class UnaryPredicate>
+ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor,
+ UnaryPredicate finder) {
+ ApplicationSet::iterator it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ if (accessor.GetData().end() == it) {
+ LOG4CXX_DEBUG(logger_, "Unable to find application");
+ return ApplicationSharedPtr();
}
+ ApplicationSharedPtr app = *it;
+ LOG4CXX_DEBUG(logger_, " Found Application app_id = " << app->app_id());
+ return app;
+}
- request_ctrl_.DestroyThreadpool();
-
- // for PASA customer policy backup should happen :AllApp(SUSPEND)
- LOG4CXX_INFO(logger_, "Unloading policy library.");
- policy::PolicyHandler::instance()->UnloadPolicyLibrary();
+template <class UnaryPredicate>
+std::vector<ApplicationSharedPtr> FindAllApps(
+ DataAccessor<ApplicationSet> accessor, UnaryPredicate finder) {
+ std::vector<ApplicationSharedPtr> result;
+ ApplicationSetConstIt it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ while (it != accessor.GetData().end()) {
+ result.push_back(*it);
+ it = std::find_if(++it, accessor.GetData().end(), finder);
+ }
+ return result;
+}
- return true;
+DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
+ DataAccessor<ApplicationSet> accessor(applications_, applications_list_lock_);
+ return accessor;
}
-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);
- LOG4CXX_DEBUG(logger_, " app_id << " << app_id << "Found = " << app);
- return app;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, finder);
}
-ApplicationSharedPtr
-ApplicationManagerImpl::application_by_hmi_app(uint32_t hmi_app_id) const {
+ApplicationSharedPtr ApplicationManagerImpl::application_by_hmi_app(
+ uint32_t hmi_app_id) const {
HmiAppIdPredicate finder(hmi_app_id);
- ApplicationListAccessor accessor;
- ApplicationSharedPtr app = accessor.Find(finder);
- LOG4CXX_DEBUG(logger_, " hmi_app_id << " << hmi_app_id << "Found = " << app);
- return app;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, finder);
}
ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id(
- 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);
- return app;
+ const std::string& policy_app_id) const {
+ PolicyAppIdPredicate finder(policy_app_id);
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, finder);
}
bool ActiveAppPredicate(const ApplicationSharedPtr app) {
@@ -207,22 +238,18 @@ bool ActiveAppPredicate(const ApplicationSharedPtr app) {
ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
// TODO(DK) : check driver distraction
- ApplicationListAccessor accessor;
- ApplicationSharedPtr app = accessor.Find(ActiveAppPredicate);
- LOG4CXX_DEBUG(logger_, " Found = " << app);
- return app;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, ActiveAppPredicate);
}
bool LimitedAppPredicate(const ApplicationSharedPtr app) {
return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_media_application() const {
- ApplicationListAccessor accessor;
- ApplicationSharedPtr app = accessor.Find(LimitedAppPredicate);
- LOG4CXX_DEBUG(logger_, " Found = " << app);
- return app;
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
+ const {
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, LimitedAppPredicate);
}
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
@@ -231,12 +258,10 @@ bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
: false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_navi_application() const {
- ApplicationListAccessor accessor;
- ApplicationSharedPtr app = accessor.Find(LimitedNaviAppPredicate);
- LOG4CXX_DEBUG(logger_, " Found = " << app);
- return app;
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
+ const {
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, LimitedNaviAppPredicate);
}
bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
@@ -245,12 +270,10 @@ bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
: false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_voice_application() const {
- ApplicationListAccessor accessor;
- ApplicationSharedPtr app = accessor.Find(LimitedVoiceAppPredicate);
- LOG4CXX_DEBUG(logger_, " Found = " << app);
- return app;
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_voice_application()
+ const {
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, LimitedVoiceAppPredicate);
}
bool NaviAppPredicate(const ApplicationSharedPtr app) {
@@ -259,52 +282,68 @@ bool NaviAppPredicate(const ApplicationSharedPtr app) {
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;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindAllApps(accessor, NaviAppPredicate);
}
std::vector<ApplicationSharedPtr>
ApplicationManagerImpl::applications_by_button(uint32_t button) {
SubscribedToButtonPredicate finder(
static_cast<mobile_apis::ButtonName::eType>(button));
- ApplicationListAccessor accessor;
- std::vector<ApplicationSharedPtr> apps = accessor.FindAll(finder);
- LOG4CXX_DEBUG(logger_, " Found count: " << apps.size());
- return apps;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindAllApps(accessor, finder);
}
-std::vector<ApplicationSharedPtr>
-ApplicationManagerImpl::IviInfoUpdated(VehicleDataType vehicle_info,
- int value) {
+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;
+ }
+};
+std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated(
+ VehicleDataType vehicle_info, int value) {
// Notify Policy Manager if available about info it's interested in,
// i.e. odometer etc
switch (vehicle_info) {
- case ODOMETER:
- policy::PolicyHandler::instance()->KmsChanged(value);
- break;
- default:
- break;
+ case ODOMETER:
+ GetPolicyHandler().KmsChanged(value);
+ break;
+ default:
+ break;
}
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;
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindAllApps(accessor, finder);
}
void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
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(event_dispatcher());
}
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();
@@ -357,85 +396,95 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
}
ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
- const utils::SharedPtr<smart_objects::SmartObject> &
+ const utils::SharedPtr<smart_objects::SmartObject>&
request_for_registration) {
+ LOG4CXX_AUTO_TRACE(logger_);
- 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);
-
- smart_objects::SmartObject &message = *request_for_registration;
+ 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();
- }
-
// app_id is SDL "internal" ID
- // original app_id can be gotten via ApplicationImpl::mobile_app_id()
+ // original app_id can be received via ApplicationImpl::mobile_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(
- MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id].asUInt(),
- mobile_apis::Result::GENERIC_ERROR));
- ManageMobileCommand(response);
- return ApplicationSharedPtr();
- }
+ 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, commands::Command::ORIGIN_SDL);
+ 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");
+ GetPolicyHandler().OnAppsSearchStarted();
+ uint32_t timeout = get_settings().application_list_update_timeout();
+ application_list_update_timer_.Start(timeout, true);
- 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, commands::Command::ORIGIN_SDL);
+ 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);
+ }
+ ApplicationSharedPtr application(
+ new ApplicationImpl(app_id,
+ policy_app_id,
+ device_mac,
+ app_name,
+ GetPolicyHandler().GetStatisticManager(),
+ *this));
if (!application) {
usage_statistics::AppCounter count_of_rejections_sync_out_of_memory(
- policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
+ GetPolicyHandler().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,
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
message[strings::params][strings::correlation_id].asUInt(),
mobile_apis::Result::OUT_OF_MEMORY));
- ManageMobileCommand(response);
+ ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
return ApplicationSharedPtr();
}
+ application->set_folder_name(policy_app_id + "_" +
+ application->mac_address());
+ // 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>(
@@ -465,15 +514,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) &&
+ (get_settings().heart_beat_timeout() != 0)) {
+ connection_handler().StartSessionHeartBeat(connection_key);
}
// Keep HMI add id in case app is present in "waiting for registration" list
@@ -486,12 +533,17 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
apps_to_register_list_lock_.Release();
if (!application->hmi_app_id()) {
- const bool is_saved = resume_ctrl_.IsApplicationSaved(mobile_app_id);
+ const bool is_saved =
+ resume_ctrl_.IsApplicationSaved(policy_app_id, device_mac);
application->set_hmi_application_id(
- is_saved ? resume_ctrl_.GetHMIApplicationID(mobile_app_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
@@ -500,8 +552,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
applications_.insert(application);
applications_list_lock_.Release();
- policy::PolicyHandler::instance()->AddApplication(
- application->mobile_app_id());
+ GetPolicyHandler().AddApplication(application->policy_app_id());
return application;
}
@@ -519,17 +570,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_.SetRegularState<false>(app, hmi_level, audio_state);
+ state_ctrl_.SetRegularState(app, hmi_level, audio_state, false);
return true;
}
-mobile_api::HMILevel::eType
-ApplicationManagerImpl::IsHmiLevelFullAllowed(ApplicationSharedPtr app) {
+mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
+ ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
if (!app) {
LOG4CXX_ERROR(logger_, "Application pointer invalid");
@@ -549,16 +601,17 @@ ApplicationManagerImpl::IsHmiLevelFullAllowed(ApplicationSharedPtr app) {
} 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;
}
-void ApplicationManagerImpl::ConnectToDevice(const std::string &device_mac) {
+void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
// TODO(VS): Call function from ConnectionHandler
if (!connection_handler_) {
LOG4CXX_WARN(logger_, "Connection handler is not set.");
@@ -566,51 +619,54 @@ 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();
+ MessageHelper::SendGetSystemInfoRequest(*this);
utils::SharedPtr<smart_objects::SmartObject> is_vr_ready(
- MessageHelper::CreateModuleInfoSO(
- static_cast<uint32_t>(hmi_apis::FunctionID::VR_IsReady)));
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_IsReady,
+ *this));
ManageHMICommand(is_vr_ready);
utils::SharedPtr<smart_objects::SmartObject> is_tts_ready(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_IsReady));
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_IsReady,
+ *this));
ManageHMICommand(is_tts_ready);
utils::SharedPtr<smart_objects::SmartObject> is_ui_ready(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_IsReady));
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_IsReady,
+ *this));
ManageHMICommand(is_ui_ready);
utils::SharedPtr<smart_objects::SmartObject> is_navi_ready(
MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::Navigation_IsReady));
+ hmi_apis::FunctionID::Navigation_IsReady, *this));
ManageHMICommand(is_navi_ready);
utils::SharedPtr<smart_objects::SmartObject> is_ivi_ready(
MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_IsReady));
+ hmi_apis::FunctionID::VehicleInfo_IsReady, *this));
ManageHMICommand(is_ivi_ready);
utils::SharedPtr<smart_objects::SmartObject> button_capabilities(
MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::Buttons_GetCapabilities));
+ hmi_apis::FunctionID::Buttons_GetCapabilities, *this));
ManageHMICommand(button_capabilities);
utils::SharedPtr<smart_objects::SmartObject> mixing_audio_supported_request(
MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported));
+ hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
+ *this));
ManageHMICommand(mixing_audio_supported_request);
resume_controller().ResetLaunchTime();
}
@@ -625,7 +681,7 @@ uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
return corelation_id_;
}
-bool ApplicationManagerImpl::begin_audio_pass_thru() {
+bool ApplicationManagerImpl::BeginAudioPassThrough() {
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (audio_pass_thru_active_) {
return false;
@@ -635,7 +691,7 @@ bool ApplicationManagerImpl::begin_audio_pass_thru() {
}
}
-bool ApplicationManagerImpl::end_audio_pass_thru() {
+bool ApplicationManagerImpl::EndAudioPassThrough() {
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (audio_pass_thru_active_) {
audio_pass_thru_active_ = false;
@@ -645,47 +701,57 @@ bool ApplicationManagerImpl::end_audio_pass_thru() {
}
}
-void ApplicationManagerImpl::set_driver_distraction(bool is_distracting) {
+void ApplicationManagerImpl::set_driver_distraction(const bool is_distracting) {
is_distracting_driver_ = is_distracting;
}
-void ApplicationManagerImpl::set_vr_session_started(const bool &state) {
+void ApplicationManagerImpl::set_vr_session_started(const bool state) {
is_vr_session_strated_ = state;
}
-void ApplicationManagerImpl::set_all_apps_allowed(const bool &allowed) {
+void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) {
is_all_apps_allowed_ = allowed;
}
HmiStatePtr ApplicationManagerImpl::CreateRegularState(
- uint32_t app_id, mobile_apis::HMILevel::eType hmi_level,
+ 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 state(new HmiState(app_id, *this));
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_system_context(system_context);
return state;
}
-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) {
+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) {
+ 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);
- }
+ DCHECK_OR_RETURN_VOID(media_manager_);
+ media_manager_->StartMicrophoneRecording(
+ session_key, get_settings().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"
- " when PassThrough is not active");
+ LOG4CXX_ERROR(logger_,
+ "Trying to send PassThroughNotification"
+ " when PassThrough is not active");
return;
}
@@ -698,23 +764,19 @@ void ApplicationManagerImpl::SendAudioPassThroughNotification(
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
- if (NULL != media_manager_) {
- media_manager_->StopMicrophoneRecording(application_key);
- }
+ DCHECK_OR_RETURN_VOID(media_manager_);
+ media_manager_->StopMicrophoneRecording(application_key);
}
-std::string
-ApplicationManagerImpl::GetDeviceName(connection_handler::DeviceHandle handle) {
- DCHECK(connection_handler_ != 0);
-
+std::string ApplicationManagerImpl::GetDeviceName(
+ 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;
@@ -722,16 +784,13 @@ ApplicationManagerImpl::GetDeviceName(connection_handler::DeviceHandle handle) {
hmi_apis::Common_TransportType::eType
ApplicationManagerImpl::GetDeviceTransportType(
- const std::string &transport_type) {
+ 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);
}
@@ -752,6 +811,7 @@ void ApplicationManagerImpl::OnMessageReceived(
utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message);
if (outgoing_message) {
+ LOG4CXX_DEBUG(logger_, "Posting new Message");
messages_from_mobile_.PostMessage(
impl::MessageFromMobile(outgoing_message));
}
@@ -775,26 +835,25 @@ 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();
+ApplicationConstSharedPtr ApplicationManagerImpl::WaitingApplicationByID(
+ const uint32_t hmi_id) const {
+ AppsWaitRegistrationSet app_list = AppsWaitingForRegistration().GetData();
AppsWaitRegistrationSet::const_iterator it_end = app_list.end();
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;
}
return result;
}
-DataAccessor<ApplicationManagerImpl::AppsWaitRegistrationSet>
-ApplicationManagerImpl::apps_waiting_for_registration() const {
- return DataAccessor<AppsWaitRegistrationSet>(
- ApplicationManagerImpl::instance()->apps_to_register_,
- ApplicationManagerImpl::instance()->apps_to_register_list_lock_);
+DataAccessor<AppsWaitRegistrationSet>
+ApplicationManagerImpl::AppsWaitingForRegistration() const {
+ return DataAccessor<AppsWaitRegistrationSet>(apps_to_register_,
+ apps_to_register_list_lock_);
}
bool ApplicationManagerImpl::IsAppsQueriedFrom(
@@ -810,6 +869,14 @@ bool ApplicationManagerImpl::IsAppsQueriedFrom(
return false;
}
+StateController& ApplicationManagerImpl::state_controller() {
+ return state_ctrl_;
+}
+
+const ApplicationManagerSettings& ApplicationManagerImpl::get_settings() const {
+ return settings_;
+}
+
void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
const connection_handler::DeviceHandle handle, bool is_greyed_out) {
sync_primitives::AutoLock lock(apps_to_register_list_lock_);
@@ -821,24 +888,42 @@ void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
}
}
}
-
void ApplicationManagerImpl::OnErrorSending(
hmi_message_handler::MessageSharedPointer message) {
return;
}
void ApplicationManagerImpl::OnDeviceListUpdated(
- const connection_handler::DeviceMap &device_list) {
+ const connection_handler::DeviceMap& device_list) {
LOG4CXX_AUTO_TRACE(logger_);
+
+ // 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);
+
+ GetPolicyHandler().AddDevice(dev_params.device_mac_address,
+ device_info.connection_type);
+ }
+
smart_objects::SmartObjectSPtr msg_params =
- MessageHelper::CreateDeviceListSO(device_list);
+ MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this);
if (!msg_params) {
LOG4CXX_WARN(logger_, "Failed to create sub-smart object.");
return;
}
smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject;
- smart_objects::SmartObject &so_to_send = *update_list;
+ smart_objects::SmartObject& so_to_send = *update_list;
so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] =
hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
so_to_send[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
@@ -851,12 +936,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);
- policy::PolicyHandler::instance()->OnAppsSearchStarted();
+ uint32_t timeout = get_settings().application_list_update_timeout();
+ application_list_update_timer_.Start(timeout, true);
+ GetPolicyHandler().OnAppsSearchStarted();
}
void ApplicationManagerImpl::SendUpdateAppList() {
@@ -866,36 +950,35 @@ void ApplicationManagerImpl::SendUpdateAppList() {
using namespace hmi_apis;
SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
- FunctionID::BasicCommunication_UpdateAppList);
+ FunctionID::BasicCommunication_UpdateAppList, *this);
(*request)[strings::msg_params][strings::applications] =
SmartObject(SmartType_Array);
- SmartObject &applications =
+ SmartObject& applications =
(*request)[strings::msg_params][strings::applications];
- PrepareApplicationListSO(applications_, applications);
- PrepareApplicationListSO(apps_to_register_, applications);
+ PrepareApplicationListSO(applications_, applications, *this);
+ PrepareApplicationListSO(apps_to_register_, applications, *this);
ManageHMICommand(request);
}
void ApplicationManagerImpl::RemoveDevice(
- const connection_handler::DeviceHandle &device_handle) {
- LOG4CXX_INFO(logger_, "device_handle " << device_handle);
+ const connection_handler::DeviceHandle& 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;
- if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- const std::string policy_app_id = application->mobile_app_id();
+ if (policy_handler_.PolicyEnabled()) {
+ const std::string policy_app_id = application->policy_app_id();
std::string default_hmi_string = "";
- if (policy::PolicyHandler::instance()->GetDefaultHmi(policy_app_id,
- &default_hmi_string)) {
+ if (policy_handler_.GetDefaultHmi(policy_app_id, &default_hmi_string)) {
if ("BACKGROUND" == default_hmi_string) {
default_hmi = HMILevel::HMI_BACKGROUND;
} else if ("FULL" == default_hmi_string) {
@@ -905,21 +988,24 @@ 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;
}
-uint32_t ApplicationManagerImpl::GenerateGrammarID() { return rand(); }
+uint32_t ApplicationManagerImpl::GenerateGrammarID() {
+ return rand();
+}
uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
- LOG4CXX_TRACE(logger_, "ENTER");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t hmi_app_id = get_rand_from_range(1);
LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id);
@@ -929,79 +1015,78 @@ uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id);
}
- LOG4CXX_TRACE(logger_, "EXIT");
return hmi_app_id;
}
void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
- smart_objects::SmartObject &message) {
+ smart_objects::SmartObject& message) {
MessageHelper::PrintSmartObject(message);
if (message.keyExists(strings::app_id)) {
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(
- message[strings::app_id].asUInt());
- if (application.valid()) {
- LOG4CXX_INFO(logger_, "ReplaceMobileByHMIAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->hmi_app_id());
- message[strings::app_id] = application->hmi_app_id();
+ ApplicationSharedPtr application_ptr =
+ application(message[strings::app_id].asUInt());
+ if (application_ptr.valid()) {
+ LOG4CXX_DEBUG(logger_,
+ "ReplaceMobileByHMIAppId from "
+ << message[strings::app_id].asInt() << " to "
+ << application_ptr->hmi_app_id());
+ message[strings::app_id] = application_ptr->hmi_app_id();
}
} else {
switch (message.getType()) {
- 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) {
- ReplaceMobileByHMIAppId(*it);
+ 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) {
+ ReplaceMobileByHMIAppId(*it);
+ }
+ break;
}
- break;
- }
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- std::string k = *key;
- ReplaceMobileByHMIAppId(message[*key]);
+ case smart_objects::SmartType::SmartType_Map: {
+ std::set<std::string> keys = message.enumerate();
+ std::set<std::string>::const_iterator key = keys.begin();
+ for (; key != keys.end(); ++key) {
+ std::string k = *key;
+ ReplaceMobileByHMIAppId(message[*key]);
+ }
+ break;
}
- 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());
+ 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 {
switch (message.getType()) {
- 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) {
- ReplaceHMIByMobileAppId(*it);
+ 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) {
+ ReplaceHMIByMobileAppId(*it);
+ }
+ break;
}
- break;
- }
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- ReplaceHMIByMobileAppId(message[*key]);
+ case smart_objects::SmartType::SmartType_Map: {
+ std::set<std::string> keys = message.enumerate();
+ std::set<std::string>::const_iterator key = keys.begin();
+ for (; key != keys.end(); ++key) {
+ ReplaceHMIByMobileAppId(message[*key]);
+ }
+ break;
}
- break;
- }
- default: { break; }
+ default: { break; }
}
}
}
@@ -1016,9 +1101,10 @@ bool ApplicationManagerImpl::StartNaviService(
if (navi_service_status_.end() == it) {
std::pair<NaviServiceStatusMap::iterator, bool> res =
navi_service_status_.insert(
- std::pair<uint32_t, std::pair<bool, bool>>(
+ 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;
@@ -1031,6 +1117,8 @@ bool ApplicationManagerImpl::StartNaviService(
application(app_id)->StartStreaming(service_type);
return true;
+ } else {
+ LOG4CXX_WARN(logger_, "Refused navi service by HMI level");
}
return false;
}
@@ -1056,50 +1144,59 @@ void ApplicationManagerImpl::StopNaviService(
LOG4CXX_WARN(logger_, "An application is not registered.");
return;
}
+
app->StopStreaming(service_type);
}
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_,
+ "ServiceType = " << type << ". Session = " << std::hex
+ << session_key);
- LOG4CXX_DEBUG(logger_, "OnServiceStartedCallback " << type << " in session 0x"
- << 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_WARN(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 unknown service");
}
return false;
}
void ApplicationManagerImpl::OnServiceEndedCallback(
- const int32_t &session_key, const protocol_handler::ServiceType &type,
- const connection_handler::CloseSessionReason &close_reason) {
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const connection_handler::CloseSessionReason& close_reason) {
using namespace helpers;
using namespace protocol_handler;
- using namespace mobile_apis;
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.");
@@ -1114,68 +1211,115 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
bool is_resuming;
bool is_unexpected_disconnect;
switch (close_reason) {
- case CloseSessionReason::kFlood: {
- reason = Result::TOO_MANY_PENDING_REQUESTS;
- is_resuming = true;
- is_unexpected_disconnect = false;
-
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- session_key, AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS);
- break;
- }
- case CloseSessionReason::kMalformed: {
- reason = Result::INVALID_ENUM;
- is_resuming = true;
- is_unexpected_disconnect = false;
- break;
- }
- case CloseSessionReason::kUnauthorizedApp: {
- reason = Result::INVALID_ENUM;
- is_resuming = true;
- is_unexpected_disconnect = false;
- break;
- }
- default: {
- reason = Result::INVALID_ENUM;
- is_resuming = true;
- is_unexpected_disconnect = true;
- break;
- }
+ case CloseSessionReason::kFlood: {
+ reason = Result::TOO_MANY_PENDING_REQUESTS;
+ is_resuming = true;
+ is_unexpected_disconnect = false;
+
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ session_key, AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS),
+ commands::Command::ORIGIN_SDL);
+ break;
+ }
+ case CloseSessionReason::kMalformed: {
+ reason = Result::INVALID_ENUM;
+ is_resuming = false;
+ is_unexpected_disconnect = false;
+ break;
+ }
+ case CloseSessionReason::kUnauthorizedApp: {
+ reason = Result::INVALID_ENUM;
+ is_resuming = true;
+ is_unexpected_disconnect = false;
+ break;
+ }
+ default: {
+ reason = Result::INVALID_ENUM;
+ is_resuming = true;
+ is_unexpected_disconnect = true;
+ break;
+ }
}
- UnregisterApplication(session_key, reason, is_resuming,
- is_unexpected_disconnect);
+ UnregisterApplication(
+ session_key, reason, is_resuming, is_unexpected_disconnect);
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_);
+ GetPolicyHandler().OnPTExchangeNeeded();
+}
+
+security_manager::SSLContext::HandshakeContext
+ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using security_manager::SSLContext;
+ ApplicationConstSharedPtr app = application(key);
+ if (app) {
+ return SSLContext::HandshakeContext(
+ custom_str::CustomString(app->policy_app_id()), app->name());
+ }
+ return SSLContext::HandshakeContext();
+}
+#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_;
+connection_handler::ConnectionHandler&
+ApplicationManagerImpl::connection_handler() const {
+ return *connection_handler_;
+}
+
+protocol_handler::ProtocolHandler& ApplicationManagerImpl::protocol_handler()
+ const {
+ return *protocol_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,7 +1341,7 @@ void ApplicationManagerImpl::SendMessageToMobile(
(*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)) {
@@ -1213,8 +1357,9 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
mobile_so_factory().attachSchema(*message, false);
- LOG4CXX_INFO(logger_, "Attached schema to message, result if valid: "
- << message->isValid());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Attached schema to message, result if valid: " << message->isValid());
// Messages to mobile are not yet prioritized so use default priority value
utils::SharedPtr<Message> message_to_send(
@@ -1224,7 +1369,7 @@ void ApplicationManagerImpl::SendMessageToMobile(
return;
}
- smart_objects::SmartObject &msg_to_mobile = *message;
+ smart_objects::SmartObject& msg_to_mobile = *message;
// If correlation_id is not present, it is from-HMI message which should be
// checked against policy permissions
if (msg_to_mobile[strings::params].keyExists(strings::correlation_id)) {
@@ -1237,7 +1382,7 @@ void ApplicationManagerImpl::SendMessageToMobile(
(*message)[strings::params][strings::function_id].asUInt());
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();
@@ -1250,13 +1395,13 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
}
const mobile_apis::Result::eType check_result = CheckPolicyPermissions(
- app->mobile_app_id(), app->hmi_level(), function_id, params);
+ app->policy_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;
}
@@ -1266,14 +1411,15 @@ void ApplicationManagerImpl::SendMessageToMobile(
(*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();
+ GetPolicyHandler().OnUpdateRequestSentToMobile();
}
}
}
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));
@@ -1290,7 +1436,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;
}
@@ -1302,9 +1448,9 @@ 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, *this));
if (!command) {
LOG4CXX_WARN(logger_,
@@ -1335,12 +1481,14 @@ bool ApplicationManagerImpl::ManageMobileCommand(
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);
+ app = 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,
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
static_cast<int32_t>(
mobile_apis::Result::APPLICATION_NOT_REGISTERED));
@@ -1372,7 +1520,6 @@ bool ApplicationManagerImpl::ManageMobileCommand(
}
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;
@@ -1386,52 +1533,69 @@ bool ApplicationManagerImpl::ManageMobileCommand(
request_ctrl_.addMobileRequest(command, app_hmi_level);
if (result == request_controller::RequestController::SUCCESS) {
- LOG4CXX_INFO(logger_, "Perform request");
+ LOG4CXX_DEBUG(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_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,
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
static_cast<int32_t>(
mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
+ ApplicationSharedPtr app_ptr = application(connection_key);
+ if (app_ptr) {
+ app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ }
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);
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS),
+ commands::Command::ORIGIN_SDL);
UnregisterApplication(connection_key,
mobile_apis::Result::TOO_MANY_PENDING_REQUESTS,
false);
+ ApplicationSharedPtr app_ptr = application(connection_key);
+ if (app_ptr) {
+ app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ }
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");
+ 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);
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::
+ REQUEST_WHILE_IN_NONE_HMI_LEVEL),
+ commands::Command::ORIGIN_SDL);
ApplicationSharedPtr app_ptr = application(connection_key);
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;
@@ -1465,8 +1629,9 @@ void ApplicationManagerImpl::SendMessageToHMI(
}
hmi_so_factory().attachSchema(*message, false);
- LOG4CXX_INFO(logger_, "Attached schema to message, result if valid: "
- << message->isValid());
+ LOG4CXX_INFO(
+ logger_,
+ "Attached schema to message, result if valid: " << message->isValid());
#ifdef HMI_DBUS_API
message_to_send->set_smart_object(*message);
@@ -1476,7 +1641,7 @@ void ApplicationManagerImpl::SendMessageToHMI(
"Cannot send message to HMI: failed to create string");
return;
}
-#endif // HMI_DBUS_API
+#endif // HMI_DBUS_API
messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send));
}
@@ -1497,7 +1662,7 @@ bool ApplicationManagerImpl::ManageHMICommand(
MessageHelper::PrintSmartObject(*message);
- CommandSharedPtr command = HMICommandFactory::CreateCommand(message);
+ CommandSharedPtr command = HMICommandFactory::CreateCommand(message, *this);
if (!command) {
LOG4CXX_WARN(logger_, "Failed to create command from smart object");
return false;
@@ -1506,15 +1671,15 @@ bool ApplicationManagerImpl::ManageHMICommand(
int32_t message_type =
(*(message.get()))[strings::params][strings::message_type].asInt();
- // Init before adding to request controller to be able to set request timeout
+ if (kRequest == message_type) {
+ LOG4CXX_DEBUG(logger_, "ManageHMICommand");
+ request_ctrl_.addHMIRequest(command);
+ }
+
if (command->Init()) {
- if (kRequest == message_type) {
- LOG4CXX_DEBUG(logger_, "ManageHMICommand");
- request_ctrl_.addHMIRequest(command);
- }
command->Run();
if (kResponse == message_type) {
- int32_t correlation_id =
+ const uint32_t correlation_id =
(*(message.get()))[strings::params][strings::correlation_id].asInt();
request_ctrl_.OnHMIResponse(correlation_id);
}
@@ -1523,39 +1688,47 @@ bool ApplicationManagerImpl::ManageHMICommand(
return false;
}
-bool ApplicationManagerImpl::Init() {
+bool ApplicationManagerImpl::Init(resumption::LastState& last_state,
+ media_manager::MediaManager* media_manager) {
LOG4CXX_TRACE(logger_, "Init application manager");
- const std::string app_storage_folder =
- profile::Profile::instance()->app_storage_folder();
+ const std::string app_storage_folder = get_settings().app_storage_folder();
if (!InitDirectory(app_storage_folder, TYPE_STORAGE) ||
!IsReadWriteAllowed(app_storage_folder, TYPE_STORAGE)) {
return false;
}
+ if (!resume_ctrl_.Init(last_state)) {
+ LOG4CXX_ERROR(logger_, "Problem with initialization of resume controller");
+ return false;
+ }
+ hmi_capabilities_.Init(&last_state);
- const std::string system_files_path =
- profile::Profile::instance()->system_files_path();
+ if (!(file_system::IsWritingAllowed(app_storage_folder) &&
+ file_system::IsReadingAllowed(app_storage_folder))) {
+ LOG4CXX_ERROR(logger_,
+ "Storage directory doesn't have read/write permissions");
+ return false;
+ }
+
+ const std::string system_files_path = get_settings().system_files_path();
if (!InitDirectory(system_files_path, TYPE_SYSTEM) ||
!IsReadWriteAllowed(system_files_path, TYPE_SYSTEM)) {
return false;
}
-
- const std::string app_icons_folder =
- profile::Profile::instance()->app_icons_folder();
+ const std::string app_icons_folder = get_settings().app_icons_folder();
if (!InitDirectory(app_icons_folder, TYPE_ICONS)) {
return false;
}
// 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()) {
+ if (GetPolicyHandler().PolicyEnabled()) {
+ if (!GetPolicyHandler().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");
- if (!policy::PolicyHandler::instance()->InitPolicyTable()) {
+ if (!GetPolicyHandler().InitPolicyTable()) {
LOG4CXX_ERROR(logger_, "Policy table is not initialized.");
return false;
}
@@ -1563,150 +1736,185 @@ bool ApplicationManagerImpl::Init() {
LOG4CXX_WARN(logger_,
"System is configured to work without policy functionality.");
}
- media_manager_ = media_manager::MediaManagerImpl::instance();
+ media_manager_ = media_manager;
+ return true;
+}
+
+bool ApplicationManagerImpl::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ stopping_application_mng_lock_.Acquire();
+ is_stopping_ = true;
+ stopping_application_mng_lock_.Release();
+ application_list_update_timer_.Stop();
+ try {
+ UnregisterAllApplications();
+ } catch (...) {
+ LOG4CXX_ERROR(logger_,
+ "An error occurred during unregistering applications.");
+ }
+ request_ctrl_.DestroyThreadpool();
+
+ // for PASA customer policy backup should happen :AllApp(SUSPEND)
+ LOG4CXX_DEBUG(logger_, "Unloading policy library.");
+ GetPolicyHandler().UnloadPolicyLibrary();
+
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_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "\t\t\tMessage to convert: protocol "
+ << message.protocol_version() << "; json "
+ << message.json_message());
switch (message.protocol_version()) {
- case ProtocolVersion::kV4:
- case ProtocolVersion::kV3:
- 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());
- 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);
- return false;
- }
- LOG4CXX_INFO(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();
- output[strings::params][strings::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());
+ case ProtocolVersion::kV4:
+ case ProtocolVersion::kV3:
+ 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());
utils::SharedPtr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
- message.connection_key(), message.function_id(),
- message.correlation_id(), mobile_apis::Result::INVALID_DATA));
- ManageMobileCommand(response);
+ message.connection_key(),
+ message.function_id(),
+ message.correlation_id(),
+ mobile_apis::Result::INVALID_DATA));
+ ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
return false;
}
- output[strings::params][strings::binary_data] = *(message.binary_data());
+ 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();
+ output[strings::params][strings::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());
+ 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);
+ return false;
+ }
+ output[strings::params][strings::binary_data] =
+ *(message.binary_data());
+ }
+ break;
}
- break;
- }
- case ProtocolVersion::kHMI: {
+ case ProtocolVersion::kHMI: {
#ifdef ENABLE_LOG
- int32_t result =
+ int32_t result =
#endif
- formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
- hmi_apis::messageType::eType>(
- message.json_message(), output);
- LOG4CXX_INFO(logger_,
- "Convertion result: "
- << result << " function id "
- << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
- if (!hmi_so_factory().attachSchema(output, false)) {
- LOG4CXX_WARN(logger_, "Failed to attach schema to object.");
- return false;
- }
- if (output.validate() != smart_objects::Errors::OK) {
- LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI");
-
- if (application_manager::MessageType::kNotification ==
- output[strings::params][strings::message_type].asInt()) {
- LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification");
- return false;
- }
-
- if (application_manager::MessageType::kRequest ==
- output[strings::params][strings::message_type].asInt()) {
- LOG4CXX_ERROR(logger_, "Ignore wrong HMI request");
+ formatters::FormatterJsonRpc::FromString<
+ hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(message.json_message(), output);
+ LOG4CXX_DEBUG(logger_,
+ "Convertion result: "
+ << result << " function id "
+ << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ if (!hmi_so_factory().attachSchema(output, false)) {
+ LOG4CXX_WARN(logger_, "Failed to attach schema to object.");
return false;
}
+ if (output.validate() != smart_objects::Errors::OK) {
+ LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI");
- output.erase(strings::msg_params);
- output[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::INVALID_DATA;
- output[strings::msg_params][strings::info] =
- std::string("Received invalid data on HMI response");
- }
- break;
- }
- case ProtocolVersion::kV1: {
- static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
-
- if (message.function_id() == 0 || message.type() == kUnknownType) {
- 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) {
-
- 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();
+ if (application_manager::MessageType::kNotification ==
+ output[strings::params][strings::message_type].asInt()) {
+ LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification");
+ return false;
+ }
- 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;
+ if (application_manager::MessageType::kRequest ==
+ output[strings::params][strings::message_type].asInt()) {
+ LOG4CXX_ERROR(logger_, "Ignore wrong HMI request");
+ return false;
+ }
- smart_objects::SmartObjectSPtr msg_to_send =
- new smart_objects::SmartObject(output);
- v1_shema.attachSchema(*msg_to_send, false);
- SendMessageToMobile(msg_to_send);
- return false;
+ output.erase(strings::msg_params);
+ output[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::INVALID_DATA;
+ output[strings::msg_params][strings::info] =
+ std::string("Received invalid data on HMI response");
}
+ break;
}
-
- break;
- }
- default:
- // TODO(PV):
- // removed NOTREACHED() because some app can still have vesion 1.
- LOG4CXX_WARN(logger_, "Application used unsupported protocol :"
- << message.protocol_version() << ".");
- return false;
+ case ProtocolVersion::kV1: {
+ static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
+
+ if (message.function_id() == 0 || message.type() == kUnknownType) {
+ 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) {
+ 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();
+
+ 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;
+
+ smart_objects::SmartObjectSPtr msg_to_send =
+ new smart_objects::SmartObject(output);
+ v1_shema.attachSchema(*msg_to_send, false);
+ SendMessageToMobile(msg_to_send);
+ return false;
+ }
+ }
+ break;
+ }
+ default:
+ // TODO(PV):
+ // removed NOTREACHED() because some app can still have vesion 1.
+ 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()) {
@@ -1714,53 +1922,54 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
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()) {
- case 0: {
- if (message.getElement(jhs::S_PARAMS)
- .getElement(jhs::S_PROTOCOL_VERSION)
- .asInt() == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
- return false;
+ 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 (protocol_version == 1) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
+ 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)) {
+ LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ return false;
+ }
+ output.set_protocol_version(
+ static_cast<ProtocolVersion>(protocol_version));
}
- output.set_protocol_version(application_manager::kV1);
- } else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+
+ break;
+ }
+ case 1: {
+ if (!formatters::FormatterJsonRpc::ToString(message, 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(application_manager::kHMI);
+ break;
}
-
- break;
- }
- case 1: {
- if (!formatters::FormatterJsonRpc::ToString(message, output_string)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ default:
+ NOTREACHED();
return false;
- }
- output.set_protocol_version(application_manager::kHMI);
- break;
- }
- default:
- NOTREACHED();
- 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)
@@ -1787,7 +1996,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
}
if (message.getElement(jhs::S_PARAMS).keyExists(strings::binary_data)) {
- application_manager::BinaryData *binaryData =
+ application_manager::BinaryData* binaryData =
new application_manager::BinaryData(
message.getElement(jhs::S_PARAMS)
.getElement(strings::binary_data)
@@ -1800,17 +2009,17 @@ 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) {
+ LOG4CXX_AUTO_TRACE(logger_);
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 &&
message->service_type() != protocol_handler::kBulk) {
// skip this message, not under handling of ApplicationManager
@@ -1818,7 +2027,7 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage(
return outgoing_message;
}
- Message *convertion_result =
+ Message* convertion_result =
MobileMessageHandler::HandleIncomingMessageProtocol(message);
if (convertion_result) {
@@ -1831,14 +2040,16 @@ 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());
+ LOG4CXX_AUTO_TRACE(logger_);
+#ifdef TELEMETRY_MONITOR
+ AMTelemetryObserver::MessageMetricSharedPtr metric(
+ new AMTelemetryObserver::MessageMetric());
metric->begin = date_time::DateTime::getCurrentTime();
-#endif // TIME_TESTER
- smart_objects::SmartObjectSPtr so_from_mobile(new smart_objects::SmartObject);
+#endif // TELEMETRY_MONITOR
+ smart_objects::SmartObjectSPtr so_from_mobile =
+ utils::MakeShared<smart_objects::SmartObject>();
+ DCHECK_OR_RETURN_VOID(so_from_mobile);
if (!so_from_mobile) {
LOG4CXX_ERROR(logger_, "Null pointer");
return;
@@ -1848,24 +2059,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)) {
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()");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject);
if (!smart_object) {
@@ -1880,15 +2091,15 @@ void ApplicationManagerImpl::ProcessMessageFromHMI(
LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
return;
}
-#endif // HMI_DBUS_API
+#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");
}
}
-hmi_apis::HMI_API &ApplicationManagerImpl::hmi_so_factory() {
+hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() {
if (!hmi_so_factory_) {
hmi_so_factory_ = new hmi_apis::HMI_API;
if (!hmi_so_factory_) {
@@ -1899,7 +2110,7 @@ hmi_apis::HMI_API &ApplicationManagerImpl::hmi_so_factory() {
return *hmi_so_factory_;
}
-mobile_apis::MOBILE_API &ApplicationManagerImpl::mobile_so_factory() {
+mobile_apis::MOBILE_API& ApplicationManagerImpl::mobile_so_factory() {
if (!mobile_so_factory_) {
mobile_so_factory_ = new mobile_apis::MOBILE_API;
if (!mobile_so_factory_) {
@@ -1910,71 +2121,93 @@ mobile_apis::MOBILE_API &ApplicationManagerImpl::mobile_so_factory() {
return *mobile_so_factory_;
}
-HMICapabilities &ApplicationManagerImpl::hmi_capabilities() {
+HMICapabilities& ApplicationManagerImpl::hmi_capabilities() {
+ return hmi_capabilities_;
+}
+
+const HMICapabilities& ApplicationManagerImpl::hmi_capabilities() const {
return hmi_capabilities_;
}
-void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject &app_data,
- SmartObject &ttsName,
- SmartObject &vrSynonym) {
+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;
}
+ }
- const ssize_t regular_id = specific_idx != -1 ? specific_idx : default_idx;
+ if ((-1 == specific_idx) && (-1 == default_idx)) {
+ LOG4CXX_DEBUG(logger_, "No suitable language found");
+ return;
+ }
- 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::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 (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");
}
}
-void ApplicationManagerImpl::CreateApplications(SmartArray &obj_array,
+void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
const uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace policy;
- using namespace profile;
const std::size_t arr_size(obj_array.size());
for (std::size_t idx = 0; idx < arr_size; ++idx) {
- const SmartObject &app_data = obj_array[idx];
+ const SmartObject& app_data = obj_array[idx];
if (!(app_data.keyExists(json::name) && app_data.keyExists(json::appId))) {
LOG4CXX_DEBUG(logger_, "The entry in query apps json is not valid");
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);
+ 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;
}
@@ -1984,7 +2217,8 @@ 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;
@@ -1996,40 +2230,46 @@ void ApplicationManagerImpl::CreateApplications(SmartArray &obj_array,
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 app_icon_dir(settings_.app_icons_folder());
+ 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)) {
+ connection_handler().GetDataOnSessionKey(
+ connection_key, NULL, NULL, &device_id)) {
LOG4CXX_ERROR(logger_,
"Failed to create application: no connection info.");
continue;
}
+ 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,
+ GetPolicyHandler().GetStatisticManager(),
+ *this));
DCHECK_OR_RETURN_VOID(app);
app->SetShemaUrl(url_scheme);
app->SetPackageName(package_name);
@@ -2050,7 +2290,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray &obj_array,
}
void ApplicationManagerImpl::ProcessQueryApp(
- const smart_objects::SmartObject &sm_object,
+ const smart_objects::SmartObject& sm_object,
const uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace policy;
@@ -2060,47 +2300,53 @@ void ApplicationManagerImpl::ProcessQueryApp(
return;
}
- SmartArray *obj_array = sm_object[json::response].asArray();
+ SmartArray* obj_array = sm_object[json::response].asArray();
if (NULL != obj_array) {
CreateApplications(*obj_array, connection_key);
SendUpdateAppList();
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);
+ MessageHelper::SendSetAppIcon(
+ (*it)->hmi_app_id(), full_icon_path, *this);
}
}
}
}
-#ifdef TIME_TESTER
-void ApplicationManagerImpl::SetTimeMetricObserver(AMMetricObserver *observer) {
+bool ApplicationManagerImpl::is_attenuated_supported() const {
+ return hmi_capabilities().attenuated_supported() &&
+ get_settings().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) {
+ const commands::Command* notification) {
request_ctrl_.removeNotification(notification);
}
void ApplicationManagerImpl::updateRequestTimeout(
- uint32_t connection_key, uint32_t mobile_correlation_id,
+ 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) {
+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);
@@ -2120,13 +2366,13 @@ void ApplicationManagerImpl::set_application_id(const int32_t correlation_id,
}
void ApplicationManagerImpl::AddPolicyObserver(
- policy::PolicyHandlerObserver *listener) {
- policy::PolicyHandler::instance()->add_listener(listener);
+ policy::PolicyHandlerObserver* listener) {
+ GetPolicyHandler().add_listener(listener);
}
void ApplicationManagerImpl::RemovePolicyObserver(
- policy::PolicyHandlerObserver *listener) {
- policy::PolicyHandler::instance()->remove_listener(listener);
+ policy::PolicyHandlerObserver* listener) {
+ GetPolicyHandler().remove_listener(listener);
}
void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
@@ -2137,28 +2383,32 @@ void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
void ApplicationManagerImpl::HeadUnitReset(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
- stopping_flag_lock_.Acquire();
+ stopping_application_mng_lock_.Acquire();
is_stopping_ = true;
- stopping_flag_lock_.Release();
+ stopping_application_mng_lock_.Release();
switch (reason) {
- case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: {
- UnregisterAllApplications();
- policy::PolicyHandler::instance()->ResetPolicyTable();
- policy::PolicyHandler::instance()->UnloadPolicyLibrary();
+ case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: {
+ UnregisterAllApplications();
+ GetPolicyHandler().ResetPolicyTable();
+ GetPolicyHandler().UnloadPolicyLibrary();
+
+ resume_controller().StopSavePersistentDataTimer();
+ file_system::remove_directory_content(
+ get_settings().app_storage_folder());
+ break;
+ }
+ case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: {
+ GetPolicyHandler().ClearUserConsent();
- resume_controller().StopSavePersistentDataTimer();
- file_system::remove_directory_content(
- profile::Profile::instance()->app_storage_folder());
- break;
- }
- case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: {
- policy::PolicyHandler::instance()->ClearUserConsent();
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Bad AppInterfaceUnregisteredReason");
- return;
- }
+ resume_controller().StopSavePersistentDataTimer();
+ file_system::remove_directory_content(
+ get_settings().app_storage_folder());
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Bad AppInterfaceUnregisteredReason");
+ return;
+ }
}
}
@@ -2188,8 +2438,9 @@ void ApplicationManagerImpl::SendOnSDLClose() {
new Message(protocol_handler::MessagePriority::kDefault));
hmi_so_factory().attachSchema(*msg, false);
- LOG4CXX_DEBUG(logger_, "Attached schema to message, result if valid: "
- << msg->isValid());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Attached schema to message, result if valid: " << msg->isValid());
#ifdef HMI_DBUS_API
message_to_send->set_smart_object(*msg);
@@ -2199,7 +2450,7 @@ void ApplicationManagerImpl::SendOnSDLClose() {
"Cannot send message to HMI: failed to create string");
return;
}
-#endif // HMI_DBUS_API
+#endif // HMI_DBUS_API
if (!hmi_handler_) {
LOG4CXX_WARN(logger_, "No HMI Handler set");
@@ -2225,32 +2476,26 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
ClearTTSGlobalPropertiesList();
- { // A local scope to limit accessor's lifetime and release app list lock.
- ApplicationListAccessor accessor;
- ApplictionSetConstIt it = accessor.begin();
- while (it != accessor.end()) {
+ { // A local scope to limit accessor's lifetime and release app list lock.
+ DataAccessor<ApplicationSet> accessor = applications();
+ ApplicationSetConstIt it = accessor.GetData().begin();
+ while (it != accessor.GetData().end()) {
ApplicationSharedPtr app_to_remove = *it;
-
-#ifdef CUSTOMER_PASA
- if (!is_ignition_off) {
-#endif // CUSTOMER_PASA
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app_to_remove->app_id(), unregister_reason_);
-#ifdef CUSTOMER_PASA
- }
-#endif // CUSTOMER_PASA
-
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_to_remove->app_id(), unregister_reason_),
+ commands::Command::ORIGIN_SDL);
UnregisterApplication(app_to_remove->app_id(),
- mobile_apis::Result::INVALID_ENUM, is_ignition_off,
+ mobile_apis::Result::INVALID_ENUM,
+ is_ignition_off,
is_unexpected_disconnect);
- connection_handler_->CloseSession(app_to_remove->app_id(),
+ connection_handler().CloseSession(app_to_remove->app_id(),
connection_handler::kCommon);
- it = accessor.begin();
+ it = accessor.GetData().begin();
}
}
-
- if (is_ignition_off) { // Move this block before unregistering apps?
- resume_controller().Suspend();
+ if (is_ignition_off) {
+ resume_controller().OnSuspend();
}
request_ctrl_.terminateAllHMIRequests();
}
@@ -2263,23 +2508,39 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
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.");
+ 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,
+ 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);
+ LOG4CXX_DEBUG(logger_,
+ "app_id = " << app_id << "; reason = " << reason
+ << "; is_resuming = " << is_resuming
+ << "; is_unexpected_disconnect = "
+ << is_unexpected_disconnect);
+ size_t subscribed_for_way_points_app_count = 0;
+
+ // SDL sends UnsubscribeWayPoints only for last application
+ {
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ subscribed_for_way_points_app_count =
+ subscribed_way_points_apps_list_.size();
+ }
+ if (1 == subscribed_for_way_points_app_count) {
+ LOG4CXX_ERROR(logger_, "Send UnsubscribeWayPoints");
+ MessageHelper::SendUnsubscribedWayPoints(*this);
+ }
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
@@ -2290,35 +2551,41 @@ void ApplicationManagerImpl::UnregisterApplication(
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::TOO_MANY_PENDING_REQUESTS: {
- ApplicationSharedPtr app_ptr = application(app_id);
- if (app_ptr) {
- app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ 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();
+ if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "INSERT: " << GetHashedAppID(app_id, app_ptr->policy_app_id()));
+ forbidden_applications.insert(
+ GetHashedAppID(app_id, app_ptr->policy_app_id()));
+ }
+ }
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Unknown unregister reason " << reason);
+ break;
}
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Unknown unregister reason " << reason);
- break;
- }
}
-
ApplicationSharedPtr app_to_remove;
connection_handler::DeviceHandle handle = 0;
{
- ApplicationListAccessor accessor;
- ApplictionSetConstIt it = accessor.begin();
- for (; it != accessor.end(); ++it) {
+ DataAccessor<ApplicationSet> accessor(applications());
+ ApplicationSetConstIt it = accessor.GetData().begin();
+ for (; it != accessor.GetData().end(); ++it) {
if ((*it)->app_id() == app_id) {
app_to_remove = *it;
handle = app_to_remove->device();
@@ -2327,12 +2594,24 @@ 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);
-
+ if (is_resuming) {
+ resume_ctrl_.SaveApplication(app_to_remove);
+ } else {
+ resume_ctrl_.RemoveApplicationFromSaved(app_to_remove);
+ }
+ applications_.erase(app_to_remove);
+ (hmi_capabilities_.get_hmi_language_handler())
+ .OnUnregisterApplication(app_id);
AppV4DevicePredicate finder(handle);
- ApplicationSharedPtr app = accessor.Find(finder);
+ ApplicationSharedPtr app = FindApp(accessor, finder);
if (!app) {
LOG4CXX_DEBUG(
logger_, "There is no more SDL4 apps with device handle: " << handle);
@@ -2341,40 +2620,32 @@ void ApplicationManagerImpl::UnregisterApplication(
SendUpdateAppList();
}
}
-
- if (is_resuming) {
- resume_ctrl_.SaveApplication(app_to_remove);
- } else {
- resume_ctrl_.RemoveApplicationFromSaved(app_to_remove->mobile_app_id());
- }
-
if (audio_pass_thru_active_) {
// May be better to put this code in MessageHelper?
- end_audio_pass_thru();
+ EndAudioPassThrough();
StopAudioPassThru(app_id);
- MessageHelper::SendStopAudioPathThru();
+ MessageHelper::SendStopAudioPathThru(*this);
}
- MessageHelper::SendOnAppUnregNotificationToHMI(app_to_remove,
- is_unexpected_disconnect);
+ MessageHelper::SendOnAppUnregNotificationToHMI(
+ app_to_remove, is_unexpected_disconnect, *this);
request_ctrl_.terminateAppRequests(app_id);
return;
}
-void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t &app_id) {
- connection_handler_->CloseSession(app_id,
+void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
+ 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_);
+ sync_primitives::AutoLock lock(stopping_application_mng_lock_);
if (is_stopping_) {
LOG4CXX_INFO(logger_, "Application manager is stopping");
return;
@@ -2400,7 +2671,7 @@ 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(
+ if (1 < connection_handler().GetConnectionSessionsCount(
message->connection_key())) {
is_final = false;
close_session = true;
@@ -2411,13 +2682,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.");
@@ -2428,27 +2699,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");
+ 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;
@@ -2458,16 +2729,20 @@ 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_INFO_EXT(logger_, "Send data");
+ LOG4CXX_DEBUG(logger_, "After fill binary data");
+ LOG4CXX_DEBUG(logger_, "Send data");
CommandSharedPtr command(MobileCommandFactory::CreateCommand(
- on_audio_pass, commands::Command::ORIGIN_SDL));
+ on_audio_pass, commands::Command::ORIGIN_SDL, *this));
+ if (!command) {
+ LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object");
+ return;
+ }
+
if (command->Init()) {
command->Run();
command->CleanUp();
@@ -2475,13 +2750,15 @@ void ApplicationManagerImpl::Handle(const impl::AudioData message) {
}
mobile_apis::Result::eType ApplicationManagerImpl::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) {
- LOG4CXX_INFO(logger_, "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) {
+ 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()) {
+ if (!GetPolicyHandler().PolicyEnabled()) {
return mobile_apis::Result::SUCCESS;
}
@@ -2489,13 +2766,16 @@ 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);
+ 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);
+ GetPolicyHandler().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;
@@ -2530,15 +2810,15 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
app->usage_report().RecordPolicyRejectedRpcCall();
switch (result.hmi_level_permitted) {
- case policy::kRpcDisallowed:
- return mobile_apis::Result::DISALLOWED;
- case policy::kRpcUserDisallowed:
- return mobile_apis::Result::USER_DISALLOWED;
- default:
- return mobile_apis::Result::INVALID_ENUM;
+ case policy::kRpcDisallowed:
+ return mobile_apis::Result::DISALLOWED;
+ case policy::kRpcUserDisallowed:
+ return mobile_apis::Result::USER_DISALLOWED;
+ default:
+ 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;
}
@@ -2553,6 +2833,17 @@ bool ApplicationManagerImpl::IsLowVoltage() {
return is_low_voltage_;
}
+std::string ApplicationManagerImpl::GetHashedAppID(
+ uint32_t connection_key, const std::string& mobile_app_id) const {
+ 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_);
@@ -2586,6 +2877,7 @@ bool ApplicationManagerImpl::CanAppStream(
} else {
LOG4CXX_WARN(logger_, "Unsupported service_type " << service_type);
}
+
return HMILevelAllowsStreaming(app_id, service_type) && is_allowed;
}
@@ -2602,18 +2894,22 @@ 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_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_end_stream_.end(),
+ app_id)) {
return;
}
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it ||
(!it->second.first && !it->second.second)) {
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app_id, PROTOCOL_VIOLATION);
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, PROTOCOL_VIOLATION),
+ commands::Command::ORIGIN_SDL);
UnregisterApplication(app_id, ABORTED);
return;
}
@@ -2653,41 +2949,46 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t 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_, true);
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,
+ 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;
}
@@ -2698,39 +2999,72 @@ void ApplicationManagerImpl::OnHMILevelChanged(
}
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_, true);
sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.push_back(endStreamTimer);
+ timer_pool_.push_back(end_stream_timer);
}
} else if (to == HMI_NONE) {
+ LOG4CXX_TRACE(logger_, "HMILevel to NONE");
if (from == HMI_FULL || from == HMI_LIMITED || from == HMI_BACKGROUND) {
EndNaviServices(app_id);
}
}
}
+void ApplicationManagerImpl::SendHMIStatusNotification(
+ const utils::SharedPtr<Application> 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]->is_running()) {
new_timer_pool.push_back(timer_pool_[i]);
}
}
@@ -2750,8 +3084,12 @@ void ApplicationManagerImpl::CloseNaviApp() {
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
if (it->second.first || it->second.second) {
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app_id, PROTOCOL_VIOLATION);
+ LOG4CXX_INFO(logger_,
+ "App haven't answered for EndService. Unregister it.");
+ ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, PROTOCOL_VIOLATION),
+ commands::Command::ORIGIN_SDL);
UnregisterApplication(app_id, ABORTED);
}
}
@@ -2813,6 +3151,17 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) {
}
}
+bool ApplicationManagerImpl::IsApplicationForbidden(
+ uint32_t connection_key, const std::string& mobile_app_id) const {
+ const std::string name = GetHashedAppID(connection_key, mobile_app_id);
+ return forbidden_applications.find(name) != forbidden_applications.end();
+}
+
+policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice(
+ const std::string& device_id) const {
+ return policy_handler_.GetUserConsentForDevice(device_id);
+}
+
void ApplicationManagerImpl::OnWakeUp() {
LOG4CXX_AUTO_TRACE(logger_);
is_low_voltage_ = false;
@@ -2820,10 +3169,13 @@ void ApplicationManagerImpl::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.");
@@ -2831,40 +3183,43 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
}
const std::string full_file_path = file_path + "/" + file_name;
- int64_t file_size = file_system::FileSize(full_file_path);
- std::ofstream *file_stream;
+ const int64_t file_size = file_system::FileSize(full_file_path);
+ 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(
+ 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 uint32_t app_quota = profile::Profile::instance()->app_dir_quota();
- std::string app_storage_path =
- profile::Profile::instance()->app_storage_folder();
+ const std::string& folder_name) {
+ const uint32_t app_quota = settings_.app_dir_quota();
+ std::string app_storage_path = settings_.app_storage_folder();
app_storage_path += "/";
app_storage_path += folder_name;
@@ -2896,7 +3251,7 @@ bool ApplicationManagerImpl::IsHMICooperating() const {
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
LOG4CXX_DEBUG(logger_, "Application list update timer finished");
SendUpdateAppList();
- policy::PolicyHandler::instance()->OnAppsSearchCompleted();
+ GetPolicyHandler().OnAppsSearchCompleted();
}
void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
@@ -2920,7 +3275,8 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
for (uint32_t i = 0; i < app_list.size(); ++i) {
LOG4CXX_INFO(logger_,
"Send TTS GlobalProperties to HMI with default helpPrompt");
- MessageHelper::SendTTSGlobalProperties(application(app_list[i]), true);
+ MessageHelper::SendTTSGlobalProperties(
+ application(app_list[i]), true, *this);
RemoveAppFromTTSGlobalPropertiesList(app_list[i]);
}
}
@@ -2929,8 +3285,7 @@ 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 = get_settings().tts_global_properties_timeout();
TimevalStruct current_time = date_time::DateTime::getCurrentTime();
current_time.tv_sec += timeout;
// please avoid AutoLock usage to avoid deadlock
@@ -2943,7 +3298,8 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
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, false);
return;
}
tts_global_properties_app_list_lock_.Release();
@@ -2959,18 +3315,18 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
if (tts_global_properties_app_list_.end() != it) {
tts_global_properties_app_list_.erase(it);
if (tts_global_properties_app_list_.empty()) {
- LOG4CXX_INFO(logger_, "Stop tts_global_properties_timer_");
+ LOG4CXX_DEBUG(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;
@@ -2998,8 +3354,8 @@ ApplicationManagerImpl::StringToAppHMIType(std::string str) {
}
bool ApplicationManagerImpl::CompareAppHMIType(
- const smart_objects::SmartObject &from_policy,
- const smart_objects::SmartObject &from_application) {
+ 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();
@@ -3021,19 +3377,20 @@ bool ApplicationManagerImpl::CompareAppHMIType(
}
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
+ 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);
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()));
+ DataAccessor<ApplicationSet> accessor(applications());
+ for (ApplicationSetIt it = accessor.GetData().begin();
+ it != accessor.GetData().end();
+ ++it) {
+ it_app_hmi_types_from_policy = app_hmi_types.find(((*it)->policy_app_id()));
if (it_app_hmi_types_from_policy != app_hmi_types.end() &&
((it_app_hmi_types_from_policy->second).size())) {
@@ -3051,7 +3408,7 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
}
ApplicationConstSharedPtr app = *it;
- const smart_objects::SmartObject *save_application_hmi_type =
+ const smart_objects::SmartObject* save_application_hmi_type =
app->app_types();
if (save_application_hmi_type == NULL ||
@@ -3067,14 +3424,12 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
-
- MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
+ MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
} else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
-
- MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
- ApplicationManagerImpl::instance()->SetState<true>(
- (*it)->app_id(), mobile_apis::HMILevel::HMI_BACKGROUND);
+ MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
+ state_controller().SetRegularState(
+ *it, mobile_apis::HMILevel::HMI_BACKGROUND, true);
}
}
}
@@ -3083,25 +3438,28 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
- bool heart_beat_support = profile::Profile::instance()->heart_beat_timeout();
- bool sdl4_support = profile::Profile::instance()->enable_protocol_4();
+ bool heart_beat_support = get_settings().heart_beat_timeout();
+ bool sdl4_support = protocol_handler_->get_settings().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;
}
+event_engine::EventDispatcher& ApplicationManagerImpl::event_dispatcher() {
+ return event_dispatcher_;
+}
+
const std::string ApplicationManagerImpl::DirectoryTypeToString(
ApplicationManagerImpl::DirectoryType type) const {
DirectoryTypeMap::const_iterator it = dir_type_to_string_map_.find(type);
@@ -3112,24 +3470,25 @@ 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,
+bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path,
DirectoryType type) const {
const std::string directory_type = DirectoryTypeToString(type);
if (!(file_system::IsWritingAllowed(path) &&
@@ -3140,8 +3499,8 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string &path,
return false;
}
- LOG4CXX_DEBUG(logger_, directory_type
- << " directory has read/write permissions.");
+ LOG4CXX_DEBUG(logger_,
+ directory_type << " directory has read/write permissions.");
return true;
}
@@ -3152,6 +3511,41 @@ void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() {
tts_global_properties_app_list_.clear();
}
-ApplicationManagerImpl::ApplicationListAccessor::~ApplicationListAccessor() {}
+bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
+ const uint32_t app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ if (subscribed_way_points_apps_list_.find(app_id) ==
+ subscribed_way_points_apps_list_.end()) {
+ return false;
+ }
+ return true;
+}
+
+void ApplicationManagerImpl::SubscribeAppForWayPoints(const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ subscribed_way_points_apps_list_.insert(app_id);
+}
+
+void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
+ const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ subscribed_way_points_apps_list_.erase(app_id);
+}
+
+bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ return !subscribed_way_points_apps_list_.empty();
+}
+
+const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
+ return subscribed_way_points_apps_list_;
+}
-} // namespace application_manager
+} // 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_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 5fd3449165..0a3e65a790 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -31,7 +31,8 @@
*/
#include "application_manager/commands/command_impl.h"
-#include "config_profile/profile.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
@@ -42,17 +43,18 @@ const int32_t CommandImpl::hmi_protocol_type_ = 1;
const int32_t CommandImpl::mobile_protocol_type_ = 0;
const int32_t CommandImpl::protocol_version_ = 3;
-CommandImpl::CommandImpl(const MessageSharedPtr& message)
- : message_(message),
- default_timeout_(profile::Profile::instance()->default_timeout()),
- allowed_to_terminate_(true) {
-}
+CommandImpl::CommandImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : message_(message)
+ , default_timeout_(application_manager.get_settings().default_timeout())
+ , allowed_to_terminate_(true)
+ , application_manager_(application_manager) {}
CommandImpl::~CommandImpl() {
CleanUp();
}
-bool CommandImpl::CheckPermissions(){
+bool CommandImpl::CheckPermissions() {
return true;
}
@@ -64,8 +66,7 @@ bool CommandImpl::CleanUp() {
return true;
}
-void CommandImpl::Run() {
-}
+void CommandImpl::Run() {}
uint32_t CommandImpl::default_timeout() const {
return default_timeout_;
@@ -83,8 +84,87 @@ uint32_t CommandImpl::connection_key() const {
return (*message_)[strings::params][strings::connection_key].asUInt();
}
-void CommandImpl::onTimeOut() {
+void CommandImpl::onTimeOut() {}
+
+bool CommandImpl::AllowedToTerminate() {
+ return allowed_to_terminate_;
+}
+
+void CommandImpl::SetAllowedToTerminate(const bool allowed) {
+ allowed_to_terminate_ = allowed;
+}
+
+void CommandImpl::ReplaceMobileByHMIAppId(
+ NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
+ if (message.keyExists(strings::app_id)) {
+ ApplicationSharedPtr application =
+ application_manager_.application(message[strings::app_id].asUInt());
+ if (application.valid()) {
+ LOG4CXX_DEBUG(logger_,
+ "ReplaceMobileByHMIAppId from "
+ << message[strings::app_id].asInt() << " to "
+ << application->hmi_app_id());
+ message[strings::app_id] = application->hmi_app_id();
+ }
+ } else {
+ switch (message.getType()) {
+ 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) {
+ ReplaceMobileByHMIAppId(*it);
+ }
+ break;
+ }
+ case smart_objects::SmartType::SmartType_Map: {
+ std::set<std::string> keys = message.enumerate();
+ std::set<std::string>::const_iterator key = keys.begin();
+ for (; key != keys.end(); ++key) {
+ std::string k = *key;
+ ReplaceMobileByHMIAppId(message[*key]);
+ }
+ break;
+ }
+ default: { break; }
+ }
+ }
+}
+void CommandImpl::ReplaceHMIByMobileAppId(
+ NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
+ if (message.keyExists(strings::app_id)) {
+ ApplicationSharedPtr application =
+ application_manager_.application_by_hmi_app(
+ message[strings::app_id].asUInt());
+
+ if (application.valid()) {
+ LOG4CXX_DEBUG(logger_,
+ "ReplaceHMIByMobileAppId from "
+ << message[strings::app_id].asInt() << " to "
+ << application->app_id());
+ message[strings::app_id] = application->app_id();
+ }
+ } else {
+ switch (message.getType()) {
+ 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) {
+ ReplaceHMIByMobileAppId(*it);
+ }
+ break;
+ }
+ case smart_objects::SmartType::SmartType_Map: {
+ std::set<std::string> keys = message.enumerate();
+ std::set<std::string>::const_iterator key = keys.begin();
+ for (; key != keys.end(); ++key) {
+ ReplaceHMIByMobileAppId(message[*key]);
+ }
+ break;
+ }
+ default: { break; }
+ }
+ }
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
index ee7afaddf9..5b44abeec9 100644
--- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/command_notification_from_mobile_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace application_manager {
@@ -39,12 +39,10 @@ namespace application_manager {
namespace commands {
CommandNotificationFromMobileImpl::CommandNotificationFromMobileImpl(
- const MessageSharedPtr& message)
- : CommandImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {}
-CommandNotificationFromMobileImpl::~CommandNotificationFromMobileImpl() {
-}
+CommandNotificationFromMobileImpl::~CommandNotificationFromMobileImpl() {}
bool CommandNotificationFromMobileImpl::Init() {
return true;
@@ -54,8 +52,7 @@ bool CommandNotificationFromMobileImpl::CleanUp() {
return true;
}
-void CommandNotificationFromMobileImpl::Run() {
-}
+void CommandNotificationFromMobileImpl::Run() {}
void CommandNotificationFromMobileImpl::SendNotification() {
(*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
@@ -66,7 +63,7 @@ void CommandNotificationFromMobileImpl::SendNotification() {
LOG4CXX_INFO(logger_, "SendNotification");
MessageHelper::PrintSmartObject(*message_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc
index c99f2d9086..b6b0e7d500 100644
--- a/src/components/application_manager/src/commands/command_notification_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_impl.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/command_notification_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace application_manager {
@@ -39,12 +39,10 @@ namespace application_manager {
namespace commands {
CommandNotificationImpl::CommandNotificationImpl(
- const MessageSharedPtr& message)
- : CommandImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {}
-CommandNotificationImpl::~CommandNotificationImpl() {
-}
+CommandNotificationImpl::~CommandNotificationImpl() {}
bool CommandNotificationImpl::Init() {
return true;
@@ -54,8 +52,7 @@ bool CommandNotificationImpl::CleanUp() {
return true;
}
-void CommandNotificationImpl::Run() {
-}
+void CommandNotificationImpl::Run() {}
void CommandNotificationImpl::SendNotification() {
(*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
@@ -66,7 +63,7 @@ void CommandNotificationImpl::SendNotification() {
LOG4CXX_INFO(logger_, "SendNotification");
MessageHelper::PrintSmartObject(*message_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..b3b463328f 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -33,7 +33,7 @@
#include <algorithm>
#include <string>
#include "application_manager/commands/command_request_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
#include "smart_objects/smart_object.h"
@@ -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,19 @@ 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) {
-}
+CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher())
+ , current_state_(kAwaitingHMIResponse) {}
-CommandRequestImpl::~CommandRequestImpl() {
-}
+CommandRequestImpl::~CommandRequestImpl() {}
bool CommandRequestImpl::Init() {
return true;
@@ -87,8 +86,7 @@ bool CommandRequestImpl::CleanUp() {
return true;
}
-void CommandRequestImpl::Run() {
-}
+void CommandRequestImpl::Run() {}
void CommandRequestImpl::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -107,19 +105,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);
+ application_manager_.ManageMobileCommand(response, ORIGIN_SDL);
}
-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 +154,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);
@@ -171,10 +172,11 @@ void CommandRequestImpl::SendResponse(
response[strings::msg_params][strings::success] = success;
response[strings::msg_params][strings::result_code] = result_code;
- ApplicationManagerImpl::instance()->ManageMobileCommand(result);
+ application_manager_.ManageMobileCommand(result, ORIGIN_SDL);
}
-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 +196,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();
+ application_manager_.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);
}
@@ -218,7 +222,7 @@ uint32_t CommandRequestImpl::SendHMIRequest(
request[strings::msg_params] = *msg_params;
}
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(result)) {
+ if (!application_manager_.ManageHMICommand(result)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
}
@@ -228,7 +232,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.");
@@ -245,14 +248,13 @@ void CommandRequestImpl::CreateHMINotification(
notify[strings::params][strings::function_id] = function_id;
notify[strings::msg_params] = msg_params;
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(result)) {
+ if (!application_manager_.ManageHMICommand(result)) {
LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
}
}
mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
const hmi_apis::Common_Result::eType& hmi_code) const {
-
mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR;
switch (hmi_code) {
case hmi_apis::Common_Result::SUCCESS: {
@@ -351,6 +353,10 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
mobile_result = mobile_apis::Result::USER_DISALLOWED;
break;
}
+ case hmi_apis::Common_Result::SAVED: {
+ mobile_result = mobile_apis::Result::SAVED;
+ break;
+ }
default: {
LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
break;
@@ -361,7 +367,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 ==
@@ -369,97 +375,96 @@ bool CommandRequestImpl::CheckAllowedParameters() {
return true;
}
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list =
- accessor.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list_end =
- accessor.end();
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ 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);
}
}
}
- 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_.CheckPolicyPermissions(
+ (*it_app_list).get()->policy_app_id(),
+ (*it_app_list).get()->hmi_level(),
+ static_cast<mobile_api::FunctionID::eType>(function_id()),
+ params,
+ &parameters_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);
+ application_manager_.SendMessageToMobile(response);
return false;
}
// If no parameters specified in policy table, no restriction will be
// applied for parameters
- if (params_permissions.allowed_params.empty() &&
- params_permissions.disallowed_params.empty() &&
- params_permissions.undefined_params.empty()) {
+ if (parameters_permissions_.allowed_params.empty() &&
+ parameters_permissions_.disallowed_params.empty() &&
+ parameters_permissions_.undefined_params.empty()) {
return true;
}
- RemoveDisallowedParameters(params_permissions);
+ RemoveDisallowedParameters();
}
}
return true;
}
-void CommandRequestImpl::RemoveDisallowedParameters(
- const CommandParametersPermissions& params_permissions) {
- LOG4CXX_INFO(logger_, "RemoveDisallowedParameters");
+void CommandRequestImpl::RemoveDisallowedParameters() {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& params = (*message_)[strings::msg_params];
// Remove from request all disallowed parameters
std::vector<std::string>::const_iterator it_disallowed =
- params_permissions.disallowed_params.begin();
+ parameters_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) {
+ parameters_permissions_.disallowed_params.end();
+ 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);
+ removed_parameters_permissions_.disallowed_params.push_back(
+ *it_disallowed);
+ LOG4CXX_INFO(
+ logger_,
+ "Following parameter is disallowed by user: " << *it_disallowed);
}
}
// Remove from request all undefined yet parameters
std::vector<std::string>::const_iterator it_undefined =
- params_permissions.undefined_params.begin();
+ parameters_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) {
+ parameters_permissions_.undefined_params.end();
+ 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);
+ removed_parameters_permissions_.undefined_params.push_back(*it_undefined);
+ LOG4CXX_INFO(
+ logger_,
+ "Following parameter is disallowed by policy: " << *it_undefined);
}
}
@@ -469,19 +474,18 @@ 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)) {
+ parameters_permissions_.allowed_params.end() ==
+ std::find(parameters_permissions_.allowed_params.begin(),
+ parameters_permissions_.allowed_params.end(),
+ key)) {
params.erase(key);
- parameters_permissions_.undefined_params.push_back(key);
+ removed_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.");
}
}
}
@@ -501,13 +505,13 @@ void CommandRequestImpl::AddDisallowedParametersToInfo(
std::string info;
std::vector<std::string>::const_iterator it =
- parameters_permissions_.disallowed_params.begin();
- for (; it != parameters_permissions_.disallowed_params.end(); ++it) {
+ removed_parameters_permissions_.disallowed_params.begin();
+ for (; it != removed_parameters_permissions_.disallowed_params.end(); ++it) {
AddDissalowedParameterToInfoString(info, (*it));
}
- it = parameters_permissions_.undefined_params.begin();
- for (; it != parameters_permissions_.undefined_params.end(); ++it) {
+ it = removed_parameters_permissions_.undefined_params.begin();
+ for (; it != removed_parameters_permissions_.undefined_params.end(); ++it) {
AddDissalowedParameterToInfoString(info, (*it));
}
@@ -527,23 +531,26 @@ void CommandRequestImpl::AddDisallowedParametersToInfo(
void CommandRequestImpl::AddDisallowedParameters(
smart_objects::SmartObject& response) {
DisallowedParamsInserter disallowed_inserter(
- response,
- mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
- std::for_each(parameters_permissions_.disallowed_params.begin(),
- parameters_permissions_.disallowed_params.end(),
+ response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
+ std::for_each(removed_parameters_permissions_.disallowed_params.begin(),
+ removed_parameters_permissions_.disallowed_params.end(),
disallowed_inserter);
DisallowedParamsInserter undefined_inserter(
- response,
- mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
- std::for_each(parameters_permissions_.undefined_params.begin(),
- parameters_permissions_.undefined_params.end(),
+ response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
+ std::for_each(removed_parameters_permissions_.undefined_params.begin(),
+ removed_parameters_permissions_.undefined_params.end(),
undefined_inserter);
}
bool CommandRequestImpl::HasDisallowedParams() const {
- return ((!parameters_permissions_.disallowed_params.empty()) ||
- (!parameters_permissions_.undefined_params.empty()));
+ return ((!removed_parameters_permissions_.disallowed_params.empty()) ||
+ (!removed_parameters_permissions_.undefined_params.empty()));
+}
+
+const CommandParametersPermissions& CommandRequestImpl::parameters_permissions()
+ const {
+ return parameters_permissions_;
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc
index d7bd9133bf..c3265230a8 100644
--- a/src/components/application_manager/src/commands/command_response_impl.cc
+++ b/src/components/application_manager/src/commands/command_response_impl.cc
@@ -31,18 +31,17 @@
*/
#include "application_manager/commands/command_response_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-CommandResponseImpl::CommandResponseImpl(const MessageSharedPtr& message)
- : CommandImpl(message) {
-}
+CommandResponseImpl::CommandResponseImpl(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {}
-CommandResponseImpl::~CommandResponseImpl() {
-}
+CommandResponseImpl::~CommandResponseImpl() {}
bool CommandResponseImpl::Init() {
return true;
@@ -52,11 +51,12 @@ bool CommandResponseImpl::CleanUp() {
return true;
}
-void CommandResponseImpl::Run() {
-}
+void CommandResponseImpl::Run() {}
void CommandResponseImpl::SendResponse(
- bool success, const mobile_apis::Result::eType& result_code, bool final_message) {
+ bool success,
+ const mobile_apis::Result::eType& result_code,
+ bool final_message) {
LOG4CXX_INFO(logger_, "Trying to send response");
(*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
@@ -80,7 +80,7 @@ void CommandResponseImpl::SendResponse(
}
}
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_, final_message);
+ application_manager_.SendMessageToMobile(message_, final_message);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/src/commands/hmi/activate_app_request.cc
index c8258bd74a..ea36cd2b0a 100644
--- a/src/components/application_manager/src/commands/hmi/activate_app_request.cc
+++ b/src/components/application_manager/src/commands/hmi/activate_app_request.cc
@@ -31,41 +31,39 @@
*/
#include "application_manager/commands/hmi/activate_app_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
namespace application_manager {
- namespace commands {
-
- ActivateAppRequest::ActivateAppRequest(
- const MessageSharedPtr& message): RequestToHMI(message) {
- }
+namespace commands {
+ActivateAppRequest::ActivateAppRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
- ActivateAppRequest::~ActivateAppRequest() {
- LOG4CXX_TRACE(logger_, "~ActivateAppRequest");
- }
+ActivateAppRequest::~ActivateAppRequest() {
+ LOG4CXX_TRACE(logger_, "~ActivateAppRequest");
+}
- void ActivateAppRequest::Run() {
- LOG4CXX_TRACE(logger_, "enter " << correlation_id());
- uint32_t app_id = RequestToHMI::application_id();
- ApplicationManagerImpl::instance()->set_application_id(correlation_id(), app_id);
+void ActivateAppRequest::Run() {
+ LOG4CXX_TRACE(logger_, "enter " << correlation_id());
+ uint32_t app_id = RequestToHMI::application_id();
+ application_manager_.set_application_id(correlation_id(), app_id);
#ifdef ENABLE_LOG
- if ((*message_)[strings::msg_params].keyExists(
- strings::activate_app_hmi_level)) {
- mobile_apis::HMILevel::eType requested_hmi_level =
- static_cast<mobile_apis::HMILevel::eType>(
- (*message_)[strings::msg_params][strings::activate_app_hmi_level].asInt());
- LOG4CXX_TRACE(logger_, "requested_hmi_level = "
- << requested_hmi_level);
- }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::activate_app_hmi_level)) {
+ mobile_apis::HMILevel::eType requested_hmi_level =
+ static_cast<mobile_apis::HMILevel::eType>(
+ (*message_)[strings::msg_params][strings::activate_app_hmi_level]
+ .asInt());
+ LOG4CXX_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level);
+ }
#endif
- SendRequest();
- LOG4CXX_TRACE(logger_, "exit");
- }
+ SendRequest();
+ LOG4CXX_TRACE(logger_, "exit");
+}
- } // namespace commands
+} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/src/commands/hmi/activate_app_response.cc
index 2f63198d82..55e704b6c4 100644
--- a/src/components/application_manager/src/commands/hmi/activate_app_response.cc
+++ b/src/components/application_manager/src/commands/hmi/activate_app_response.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/activate_app_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
namespace application_manager {
@@ -38,17 +38,17 @@ namespace application_manager {
namespace commands {
ActivateAppResponse::ActivateAppResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-ActivateAppResponse::~ActivateAppResponse() {
-}
+ActivateAppResponse::~ActivateAppResponse() {}
void ActivateAppResponse::Run() {
LOG4CXX_TRACE(logger_, "enter");
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_ActivateApp);
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
LOG4CXX_TRACE(logger_, "exit");
}
diff --git a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc
index 73c9a49def..ef75eba1e2 100644
--- a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc
@@ -39,23 +39,20 @@ namespace application_manager {
namespace commands {
AddStatisticsInfoNotification::AddStatisticsInfoNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {
-}
+AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {}
void AddStatisticsInfoNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
int type = (*message_)[strings::msg_params][hmi_notification::statistic_type]
- .asInt();
+ .asInt();
- policy::PolicyHandler::instance()->AddStatisticsInfo(type);
+ application_manager_.GetPolicyHandler().AddStatisticsInfo(type);
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc
index 548238f00f..4e096a2cda 100644
--- a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc
+++ b/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-AllowAllAppsRequest::AllowAllAppsRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+AllowAllAppsRequest::AllowAllAppsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-AllowAllAppsRequest::~AllowAllAppsRequest() {
-}
+AllowAllAppsRequest::~AllowAllAppsRequest() {}
void AllowAllAppsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void AllowAllAppsRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc
index eca9363254..ed05c3ba83 100644
--- a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc
+++ b/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc
@@ -30,23 +30,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/allow_all_apps_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-AllowAllAppsResponse::AllowAllAppsResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+AllowAllAppsResponse::AllowAllAppsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-AllowAllAppsResponse::~AllowAllAppsResponse() {
-}
+AllowAllAppsResponse::~AllowAllAppsResponse() {}
void AllowAllAppsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->set_all_apps_allowed(
+ application_manager_.SetAllAppsAllowed(
(*message_)[strings::msg_params][hmi_response::allowed].asBool());
}
diff --git a/src/components/application_manager/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/src/commands/hmi/allow_app_request.cc
index 2f0d4bcc98..5176b3b4fe 100644
--- a/src/components/application_manager/src/commands/hmi/allow_app_request.cc
+++ b/src/components/application_manager/src/commands/hmi/allow_app_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-AllowAppRequest::AllowAppRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+AllowAppRequest::AllowAppRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-AllowAppRequest::~AllowAppRequest() {
-}
+AllowAppRequest::~AllowAppRequest() {}
void AllowAppRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void AllowAppRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/src/commands/hmi/allow_app_response.cc
index 7a7f3dd560..5fd9c702b4 100644
--- a/src/components/application_manager/src/commands/hmi/allow_app_response.cc
+++ b/src/components/application_manager/src/commands/hmi/allow_app_response.cc
@@ -30,34 +30,33 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/allow_app_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
-AllowAppResponse::AllowAppResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+AllowAppResponse::AllowAppResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-AllowAppResponse::~AllowAppResponse() {
-}
+AllowAppResponse::~AllowAppResponse() {}
void AllowAppResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_key =
- (*message_)[strings::params][strings::connection_key].asInt();
+ (*message_)[strings::params][strings::connection_key].asInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application(connection_key);
+ ApplicationSharedPtr app = application_manager_.application(connection_key);
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- app->set_app_allowed((*message_)[strings::msg_params][hmi_response::allowed].asBool());
+ app->set_app_allowed(
+ (*message_)[strings::msg_params][hmi_response::allowed].asBool());
}
} // 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/basic_communication_system_request.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc
index d0251a7276..2499c21680 100644
--- a/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc
+++ b/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc
@@ -31,18 +31,16 @@
*/
#include "application_manager/commands/hmi/basic_communication_system_request.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
BasicCommunicationSystemRequest::BasicCommunicationSystemRequest(
- const MessageSharedPtr& message): RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {
-}
+BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {}
void BasicCommunicationSystemRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +50,3 @@ void BasicCommunicationSystemRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc
index 6106266d19..16afce92e0 100644
--- a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc
+++ b/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/basic_communication_system_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,17 +39,17 @@ namespace application_manager {
namespace commands {
BasicCommunicationSystemResponse::BasicCommunicationSystemResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {
-}
+BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {}
void BasicCommunicationSystemResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_SystemRequest);
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_SystemRequest);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc
index 87cf1aa783..e6b73879e5 100644
--- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc
+++ b/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {
-}
+ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {}
void ButtonGetCapabilitiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -54,4 +52,3 @@ void ButtonGetCapabilitiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc
index bb04636aba..a947fb7ba9 100644
--- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc
+++ b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/button_get_capabilities_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "utils/logger.h"
namespace application_manager {
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {
-}
+ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {}
void ButtonGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -56,8 +54,7 @@ void ButtonGetCapabilitiesResponse::Run() {
return;
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_button_capabilities(
(*message_)[strings::msg_params][hmi_response::capabilities]);
diff --git a/src/components/application_manager/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/src/commands/hmi/close_popup_request.cc
index 352a281348..b0ab48dd96 100644
--- a/src/components/application_manager/src/commands/hmi/close_popup_request.cc
+++ b/src/components/application_manager/src/commands/hmi/close_popup_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-ClosePopupRequest::ClosePopupRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ClosePopupRequest::ClosePopupRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-ClosePopupRequest::~ClosePopupRequest() {
-}
+ClosePopupRequest::~ClosePopupRequest() {}
void ClosePopupRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void ClosePopupRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/src/commands/hmi/close_popup_response.cc
index 078d24ef2d..15adb2ee32 100644
--- a/src/components/application_manager/src/commands/hmi/close_popup_response.cc
+++ b/src/components/application_manager/src/commands/hmi/close_popup_response.cc
@@ -35,12 +35,11 @@ namespace application_manager {
namespace commands {
-ClosePopupResponse::ClosePopupResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ClosePopupResponse::ClosePopupResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-ClosePopupResponse::~ClosePopupResponse() {
-}
+ClosePopupResponse::~ClosePopupResponse() {}
void ClosePopupResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/dial_number_request.cc b/src/components/application_manager/src/commands/hmi/dial_number_request.cc
index 0e8e359e7e..b26541cb01 100644
--- a/src/components/application_manager/src/commands/hmi/dial_number_request.cc
+++ b/src/components/application_manager/src/commands/hmi/dial_number_request.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Ford Motor Company
+ * Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,20 +38,18 @@ namespace commands {
namespace hmi {
-DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-DialNumberRequest::~DialNumberRequest() {
-}
+DialNumberRequest::~DialNumberRequest() {}
void DialNumberRequest::Run() {
SendRequest();
}
-} // namespace hmi
+} // namespace hmi
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/dial_number_response.cc b/src/components/application_manager/src/commands/hmi/dial_number_response.cc
index 3f616bf47f..5511fa98f8 100644
--- a/src/components/application_manager/src/commands/hmi/dial_number_response.cc
+++ b/src/components/application_manager/src/commands/hmi/dial_number_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Ford Motor Company
+ * Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,20 +37,20 @@ namespace commands {
namespace hmi {
-DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-DialNumberResponse::~DialNumberResponse() {
-}
+DialNumberResponse::~DialNumberResponse() {}
void DialNumberResponse::Run() {
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_DialNumber);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
-} // namespace hmi
+} // namespace hmi
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/src/commands/hmi/get_system_info_request.cc
index 9024331462..379027c43a 100644
--- a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc
+++ b/src/components/application_manager/src/commands/hmi/get_system_info_request.cc
@@ -31,29 +31,25 @@
*/
#include "application_manager/commands/hmi/get_system_info_request.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
GetSystemInfoRequest::GetSystemInfoRequest(
- const MessageSharedPtr& message): RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-GetSystemInfoRequest::~GetSystemInfoRequest() {
-}
+GetSystemInfoRequest::~GetSystemInfoRequest() {}
void GetSystemInfoRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
uint32_t correlation_id = RequestToHMI::correlation_id();
uint32_t app_id = RequestToHMI::application_id();
- ApplicationManagerImpl::instance()->set_application_id(correlation_id, app_id);
+ application_manager_.set_application_id(correlation_id, app_id);
SendRequest();
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
index 5b1ec94e9d..be6dabb292 100644
--- a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
+++ b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
@@ -30,20 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/get_system_info_response.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
namespace application_manager {
-
namespace commands {
GetSystemInfoResponse::GetSystemInfoResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-GetSystemInfoResponse::~GetSystemInfoResponse() {
-}
+GetSystemInfoResponse::~GetSystemInfoResponse() {}
void GetSystemInfoResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -51,39 +47,36 @@ void GetSystemInfoResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- std::string ccpu_version;
- std::string wers_country_code;
- std::string language;
+ const SystemInfo& info = GetSystemInfo(code);
- if (hmi_apis::Common_Result::SUCCESS == code) {
- ccpu_version =
- (*message_)[strings::msg_params]["ccpu_version"].asString();
- wers_country_code =
- (*message_)[strings::msg_params]["wersCountryCode"].asString();
- uint32_t lang_code = (*message_)[strings::msg_params]["language"].asUInt();
- language = application_manager::MessageHelper::CommonLanguageToString(
- static_cast<hmi_apis::Common_Language::eType>(lang_code));
+ // We have to set preloaded flag as false in policy table on any response
+ // of GetSystemInfo (SDLAQ-CRS-2365)
+ application_manager_.GetPolicyHandler().OnGetSystemInfo(
+ info.ccpu_version, info.wers_country_code, info.language);
+}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
- hmi_capabilities.set_ccpu_version(ccpu_version);
- } else {
- LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
+const SystemInfo GetSystemInfoResponse::GetSystemInfo(
+ const hmi_apis::Common_Result::eType code) const {
+ SystemInfo info;
- // We have to set preloaded flag as false in policy table on any response
- // of GetSystemInfo (SDLAQ-CRS-2365)
- const std::string empty_value;
- policy::PolicyHandler::instance()->OnGetSystemInfo(empty_value,
- empty_value,
- empty_value);
- return;
+ if (hmi_apis::Common_Result::SUCCESS != code) {
+ LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
+ return info;
}
+ info.ccpu_version =
+ (*message_)[strings::msg_params]["ccpu_version"].asString();
- // We have to set preloaded flag as false in policy table on any response
- // of GetSystemInfo (SDLAQ-CRS-2365)
- policy::PolicyHandler::instance()->OnGetSystemInfo(ccpu_version,
- wers_country_code,
- language);
+ info.wers_country_code =
+ (*message_)[strings::msg_params]["wersCountryCode"].asString();
+
+ const uint32_t lang_code =
+ (*message_)[strings::msg_params]["language"].asUInt();
+ info.language = application_manager::MessageHelper::CommonLanguageToString(
+ static_cast<hmi_apis::Common_Language::eType>(lang_code));
+
+ application_manager_.hmi_capabilities().set_ccpu_version(info.ccpu_version);
+
+ return info;
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc
index 1c7d9f57c1..af220051d4 100644
--- a/src/components/application_manager/src/commands/hmi/get_urls.cc
+++ b/src/components/application_manager/src/commands/hmi/get_urls.cc
@@ -32,13 +32,27 @@
#include "application_manager/commands/hmi/get_urls.h"
#include "application_manager/message.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler.h"
+namespace {
+struct PolicyAppIdComparator {
+ PolicyAppIdComparator(const std::string& policy_app_id)
+ : policy_app_id_(policy_app_id) {}
+
+ bool operator()(const policy::EndpointData& data) {
+ return data.app_id == policy_app_id_;
+ }
+ std::string policy_app_id_;
+};
+}
+
namespace application_manager {
namespace commands {
-GetUrls::GetUrls(const MessageSharedPtr& message) : RequestFromHMI(message) {}
+GetUrls::GetUrls(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestFromHMI(message, application_manager) {}
GetUrls::~GetUrls() {}
@@ -49,7 +63,7 @@ void GetUrls::Run() {
using namespace strings;
using namespace hmi_apis;
- if (!policy::PolicyHandler::instance()->PolicyEnabled()) {
+ if (!application_manager_.GetPolicyHandler().PolicyEnabled()) {
SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
return;
}
@@ -59,9 +73,8 @@ void GetUrls::Run() {
object[msg_params][hmi_request::service].asString();
policy::EndpointUrls endpoints;
- policy::PolicyHandler::instance()->GetServiceUrls(
- object[strings::msg_params][hmi_request::service].asString(),
- endpoints);
+ application_manager_.GetPolicyHandler().GetServiceUrls(
+ object[strings::msg_params][hmi_request::service].asString(), endpoints);
if (endpoints.empty()) {
LOG4CXX_ERROR(logger_, "No URLs for service " << service_to_check);
SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
@@ -88,22 +101,29 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) {
using namespace hmi_apis;
const uint32_t app_id_to_send_to =
- policy::PolicyHandler::instance()->GetAppIdForSending();
+ application_manager_.GetPolicyHandler().GetAppIdForSending();
if (!app_id_to_send_to) {
LOG4CXX_ERROR(logger_,
"There are no available applications for processing.");
- ApplicationManagerImpl::instance()->ManageHMICommand(message_);
+ SmartObject urls(SmartType_Array);
+ FillSODefaultUrls(urls, endpoints);
+ if (!urls.empty()) {
+ (*message_)[msg_params][hmi_response::urls] = urls;
+ }
+ (*message_).erase(hmi_request::service);
+ SendResponseToHMI(Common_Result::SUCCESS);
return;
}
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(app_id_to_send_to);
+ application_manager_.application(app_id_to_send_to);
if (!app.valid()) {
LOG4CXX_WARN(logger_,
"There is no registered application with "
- "connection key '" << app_id_to_send_to << "'");
+ "connection key '"
+ << app_id_to_send_to << "'");
SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
return;
}
@@ -111,10 +131,8 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) {
SmartObject& object = *message_;
object[msg_params].erase(hmi_request::service);
object[msg_params][hmi_response::urls] = SmartObject(SmartType_Array);
-
SmartObject& urls = object[msg_params][hmi_response::urls];
-
- const std::string mobile_app_id = app->mobile_app_id();
+ const std::string mobile_app_id = app->policy_app_id();
std::string default_url = "URL is not found";
// Will use only one URL for particular application if it will be found
@@ -122,7 +140,6 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) {
SmartObject service_info = SmartObject(SmartType_Map);
for (size_t e = 0; e < endpoints.size(); ++e) {
-
if (mobile_app_id == endpoints[e].app_id) {
if (endpoints[e].url.size()) {
service_info[url] = endpoints[e].url[0];
@@ -175,10 +192,27 @@ void GetUrls::ProcessServiceURLs(const policy::EndpointUrls& endpoints) {
SendResponseToHMI(Common_Result::SUCCESS);
}
+void GetUrls::FillSODefaultUrls(smart_objects::SmartObject& urls,
+ const policy::EndpointUrls& endpoints) {
+ using namespace smart_objects;
+ LOG4CXX_AUTO_TRACE(logger_);
+ PolicyAppIdComparator comparator(policy::kDefaultId);
+ policy::EndpointUrls::const_iterator it =
+ std::find_if(endpoints.begin(), endpoints.end(), comparator);
+ if (it == endpoints.end()) {
+ return;
+ }
+ SmartObject service_info = SmartObject(SmartType_Map);
+ for (size_t i = 0; i < (*it).url.size(); ++i) {
+ service_info[strings::url] = (*it).url[i];
+ urls[i] = service_info;
+ }
+}
+
void GetUrls::SendResponseToHMI(hmi_apis::Common_Result::eType result) {
(*message_)[strings::params][strings::message_type] = MessageType::kResponse;
(*message_)[strings::params][hmi_response::code] = result;
- ApplicationManagerImpl::instance()->ManageHMICommand(message_);
+ application_manager_.ManageHMICommand(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/get_urls_response.cc b/src/components/application_manager/src/commands/hmi/get_urls_response.cc
index b446f088bf..dd9686fbce 100644
--- a/src/components/application_manager/src/commands/hmi/get_urls_response.cc
+++ b/src/components/application_manager/src/commands/hmi/get_urls_response.cc
@@ -31,24 +31,22 @@
*/
#include "application_manager/commands/hmi/get_urls_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-GetUrlsResponse::GetUrlsResponse(
- const MessageSharedPtr& message): ResponseToHMI(message) {
-}
+GetUrlsResponse::GetUrlsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseToHMI(message, application_manager) {}
-GetUrlsResponse::~GetUrlsResponse() {
-}
+GetUrlsResponse::~GetUrlsResponse() {}
void GetUrlsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc
index 059843355c..e38d1fc088 100644
--- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc
+++ b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc
@@ -37,11 +37,10 @@ namespace application_manager {
namespace commands {
MixingAudioSupportedRequest::MixingAudioSupportedRequest(
- const MessageSharedPtr& message) : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {
-}
+MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {}
void MixingAudioSupportedRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void MixingAudioSupportedRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc
index 2da8bdc453..f8b58e6f35 100644
--- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc
+++ b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc
@@ -30,26 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/mixing_audio_supported_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
MixingAudioSupportedResponse::MixingAudioSupportedResponse(
- const MessageSharedPtr& message) : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {
-}
+MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {}
void MixingAudioSupportedResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
- hmi_capabilities.set_attenuated_supported((*message_)
- [strings::msg_params][hmi_response::attenuated_supported].asBool());
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
+ hmi_capabilities.set_attenuated_supported(
+ (*message_)[strings::msg_params][hmi_response::attenuated_supported]
+ .asBool());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc
index 77b3701904..582caaa8f3 100644
--- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc
@@ -37,11 +37,10 @@ namespace application_manager {
namespace commands {
NaviAlertManeuverRequest::NaviAlertManeuverRequest(
- const MessageSharedPtr& message) : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {
-}
+NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {}
void NaviAlertManeuverRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void NaviAlertManeuverRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc
index 49d659777b..5f0422bf6a 100644
--- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/navi_alert_maneuver_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,18 +39,17 @@ namespace application_manager {
namespace commands {
NaviAlertManeuverResponse::NaviAlertManeuverResponse(
- const MessageSharedPtr& message) : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {
-}
+NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {}
void NaviAlertManeuverResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
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..920c6fbdf9 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
@@ -31,67 +31,30 @@
*/
#include "application_manager/commands/hmi/navi_audio_start_stream_request.h"
-#include "application_manager/application_manager_impl.h"
+
+#include "application_manager/message_helper.h"
#include "protocol_handler/protocol_handler.h"
-#include "config_profile/profile.h"
namespace application_manager {
namespace commands {
AudioStartStreamRequest::AudioStartStreamRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message),
- retry_number_(0) {
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher())
+ , retry_number_(0) {
LOG4CXX_AUTO_TRACE(logger_);
std::pair<uint32_t, int32_t> stream_retry =
- profile::Profile::instance()->start_stream_retry_amount();
+ application_manager_.get_settings().start_stream_retry_amount();
default_timeout_ = stream_retry.second;
retry_number_ = stream_retry.first;
- LOG4CXX_DEBUG(logger_, "default_timeout_ = " << default_timeout_
- <<"; retry_number_ = " << retry_number_);
-}
-
-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());
- }
+ LOG4CXX_DEBUG(logger_,
+ "default_timeout_ = " << default_timeout_
+ << "; retry_number_ = " << retry_number_);
}
-void AudioStartStreamRequest::onTimeOut() {
- RetryStartSession();
-
- ApplicationManagerImpl::instance()->TerminateRequest(
- connection_key(), correlation_id());
-}
+AudioStartStreamRequest::~AudioStartStreamRequest() {}
void AudioStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -100,14 +63,15 @@ void AudioStartStreamRequest::Run() {
subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream,
correlation_id());
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (app) {
app->set_audio_streaming_allowed(true);
SendRequest();
} else {
- LOG4CXX_ERROR(logger_, "Applcation with hmi_app_id "
- << application_id() << " does not exist");
+ LOG4CXX_ERROR(logger_,
+ "Applcation with hmi_app_id " << application_id()
+ << " does not exist");
}
}
@@ -115,11 +79,11 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
+ "StartAudioStreamRequest aborted. Application not found");
return;
}
@@ -133,24 +97,76 @@ 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");
- if (ApplicationManagerImpl::instance()->
- HMILevelAllowsStreaming(app->app_id(), ServiceType::kAudio)) {
+ LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
+ if (application_manager_.HMILevelAllowsStreaming(app->app_id(),
+ ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
- LOG4CXX_DEBUG(logger_,
- "StartAudioStreamRequest aborted. Application can not stream");
+ 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());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
return;
}
}
}
+void AudioStartStreamRequest::onTimeOut() {
+ RetryStartSession();
+
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
+}
+
+void AudioStartStreamRequest::RetryStartSession() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app =
+ application_manager_.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(), application_manager_);
+ app->set_audio_stream_retry_number(++curr_retry_number);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Audio start stream retry sequence stopped. "
+ << "Attempts expired.");
+
+ application_manager_.EndNaviServices(app->app_id());
+ }
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc
index 5547057a1f..c7fc7365e7 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc
@@ -35,19 +35,18 @@ namespace application_manager {
namespace commands {
-AudioStartStreamResponse::AudioStartStreamResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+AudioStartStreamResponse::AudioStartStreamResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-AudioStartStreamResponse::~AudioStartStreamResponse() {
-}
+AudioStartStreamResponse::~AudioStartStreamResponse() {}
void AudioStartStreamResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_StartAudioStream);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
index ea00d5bc3b..d0f1a96282 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
@@ -36,12 +36,10 @@ namespace application_manager {
namespace commands {
AudioStopStreamRequest::AudioStopStreamRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-AudioStopStreamRequest::~AudioStopStreamRequest() {
-}
+AudioStopStreamRequest::~AudioStopStreamRequest() {}
void AudioStopStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc
index 29e6708e19..c669d399f9 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc
@@ -35,16 +35,14 @@ namespace application_manager {
namespace commands {
-AudioStopStreamResponse::AudioStopStreamResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+AudioStopStreamResponse::AudioStopStreamResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-AudioStopStreamResponse::~AudioStopStreamResponse() {
-}
+AudioStopStreamResponse::~AudioStopStreamResponse() {}
void AudioStopStreamResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc
index 9820bb02ad..51f862c957 100644
--- a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.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,26 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/commands/hmi/on_play_tone_notification.h"
+#include "application_manager/commands/hmi/navi_get_way_points_request.h"
namespace application_manager {
namespace commands {
-OnPlayToneNotification::OnPlayToneNotification(const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+NaviGetWayPointsRequest::NaviGetWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-OnPlayToneNotification::~OnPlayToneNotification() {
-}
+NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {}
-void OnPlayToneNotification::Run() {
+void NaviGetWayPointsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- SendNotification();
+ SendRequest();
}
} // 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/navi_get_way_points_response.cc
index f4565baaf1..f295845b24 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_icon_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_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
@@ -29,7 +29,8 @@
* 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/commands/hmi/navi_get_way_points_response.h"
#include "application_manager/event_engine/event.h"
#include "interfaces/HMI_API.h"
@@ -37,19 +38,18 @@ namespace application_manager {
namespace commands {
-UISetIconResponse::UISetIconResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+NaviGetWayPointsResponse::NaviGetWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UISetIconResponse::~UISetIconResponse() {
-}
+NaviGetWayPointsResponse::~NaviGetWayPointsResponse() {}
-void UISetIconResponse::Run() {
- LOG4CXX_INFO(logger_, "UISetIconResponse::Run");
+void NaviGetWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon);
+ event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
index 4c00908781..92e972e8f4 100644
--- a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-NaviIsReadyRequest::NaviIsReadyRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+NaviIsReadyRequest::NaviIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviIsReadyRequest::~NaviIsReadyRequest() {
-}
+NaviIsReadyRequest::~NaviIsReadyRequest() {}
void NaviIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void NaviIsReadyRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
index a3387aec33..129900c60f 100644
--- a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
@@ -30,18 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/navi_is_ready_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-NaviIsReadyResponse::NaviIsReadyResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+NaviIsReadyResponse::NaviIsReadyResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviIsReadyResponse::~NaviIsReadyResponse() {
-}
+NaviIsReadyResponse::~NaviIsReadyResponse() {}
void NaviIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,8 +50,7 @@ void NaviIsReadyResponse::Run() {
is_available = object[strings::msg_params][strings::available].asBool();
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_navi_cooperating(is_available);
}
diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc
index 94d569c4ef..ad878033ca 100644
--- a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-NaviSendLocationRequest::NaviSendLocationRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+NaviSendLocationRequest::NaviSendLocationRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviSendLocationRequest::~NaviSendLocationRequest() {
-}
+NaviSendLocationRequest::~NaviSendLocationRequest() {}
void NaviSendLocationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void NaviSendLocationRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc
index 7ec5a5907d..a3d9f4c9e5 100644
--- a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc
@@ -36,19 +36,18 @@ namespace application_manager {
namespace commands {
-NaviSendLocationResponse::NaviSendLocationResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+NaviSendLocationResponse::NaviSendLocationResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviSendLocationResponse::~NaviSendLocationResponse() {
-}
+NaviSendLocationResponse::~NaviSendLocationResponse() {}
void NaviSendLocationResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc
index b477dc8dab..a92ef07d12 100644
--- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc
@@ -37,11 +37,10 @@ namespace application_manager {
namespace commands {
NaviShowConstantTBTRequest::NaviShowConstantTBTRequest(
- const MessageSharedPtr& message) : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {
-}
+NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {}
void NaviShowConstantTBTRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void NaviShowConstantTBTRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc
index 58878a3c0c..ede3272e8e 100644
--- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/navi_show_constant_tbt_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,18 +39,17 @@ namespace application_manager {
namespace commands {
NaviShowConstantTBTResponse::NaviShowConstantTBTResponse(
- const MessageSharedPtr& message) : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {
-}
+NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {}
void NaviShowConstantTBTResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
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..f0104cbaee 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
@@ -31,29 +31,30 @@
*/
#include "application_manager/commands/hmi/navi_start_stream_request.h"
-#include "application_manager/application_manager_impl.h"
+
+#include "application_manager/message_helper.h"
#include "protocol_handler/protocol_handler.h"
-#include "config_profile/profile.h"
namespace application_manager {
namespace commands {
NaviStartStreamRequest::NaviStartStreamRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message),
- retry_number_(0) {
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher())
+ , retry_number_(0) {
LOG4CXX_AUTO_TRACE(logger_);
std::pair<uint32_t, int32_t> stream_retry =
- profile::Profile::instance()->start_stream_retry_amount();
+ application_manager_.get_settings().start_stream_retry_amount();
default_timeout_ = stream_retry.second;
retry_number_ = stream_retry.first;
- LOG4CXX_DEBUG(logger_, "default_timeout_ = " << default_timeout_
- <<"; retry_number_ = " << retry_number_);
+ LOG4CXX_DEBUG(logger_,
+ "default_timeout_ = " << default_timeout_
+ << "; retry_number_ = " << retry_number_);
}
-NaviStartStreamRequest::~NaviStartStreamRequest() {
-}
+NaviStartStreamRequest::~NaviStartStreamRequest() {}
void NaviStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -62,14 +63,15 @@ void NaviStartStreamRequest::Run() {
subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream,
correlation_id());
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (app) {
app->set_video_streaming_allowed(true);
SendRequest();
} else {
- LOG4CXX_ERROR(logger_, "Applcation with hmi_app_id "
- << application_id() << "does not exist");
+ LOG4CXX_ERROR(logger_,
+ "Applcation with hmi_app_id " << application_id()
+ << "does not exist");
}
}
@@ -77,11 +79,11 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "NaviStartStreamRequest aborted. Application not found");
+ "NaviStartStreamRequest aborted. Application not found");
return;
}
@@ -95,19 +97,25 @@ 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");
- if (ApplicationManagerImpl::instance()->
- HMILevelAllowsStreaming(app->app_id(), ServiceType::kMobileNav)) {
+ LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS");
+ if (application_manager_.HMILevelAllowsStreaming(
+ app->app_id(), ServiceType::kMobileNav)) {
app->set_video_streaming_approved(true);
} else {
- LOG4CXX_DEBUG(logger_,
- "NaviStartStreamRequest aborted. Application can not stream");
+ 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());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
return;
}
}
@@ -116,38 +124,46 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
void NaviStartStreamRequest::onTimeOut() {
RetryStartSession();
- ApplicationManagerImpl::instance()->TerminateRequest(
- connection_key(), correlation_id());
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
}
void NaviStartStreamRequest::RetryStartSession() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "NaviStartStreamRequest aborted. Application not found");
+ "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. "
- << "SUCCESS received");
+ LOG4CXX_INFO(logger_,
+ "NaviStartStream retry sequence stopped. "
+ << "SUCCESS received");
app->set_video_stream_retry_number(0);
return;
}
uint32_t curr_retry_number = app->video_stream_retry_number();
if (curr_retry_number < retry_number_ - 1) {
- LOG4CXX_DEBUG(logger_, "Send NaviStartStream retry. retry_number = "
- << curr_retry_number);
- MessageHelper::SendNaviStartStream(app->app_id());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Send NaviStartStream retry. retry_number = " << curr_retry_number);
+ MessageHelper::SendNaviStartStream(app->app_id(), application_manager_);
app->set_video_stream_retry_number(++curr_retry_number);
} else {
- LOG4CXX_DEBUG(logger_, "NaviStartStream retry sequence stopped. "
- << "Attempts expired");
- app->set_video_stream_retry_number(0);
- ApplicationManagerImpl::instance()->EndNaviServices(app->app_id());
+ LOG4CXX_DEBUG(logger_,
+ "NaviStartStream retry sequence stopped. "
+ << "Attempts expired");
+
+ application_manager_.EndNaviServices(app->app_id());
}
}
diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc
index a283891054..b0b9e672c3 100644
--- a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc
@@ -35,19 +35,18 @@ namespace application_manager {
namespace commands {
-NaviStartStreamResponse::NaviStartStreamResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+NaviStartStreamResponse::NaviStartStreamResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviStartStreamResponse::~NaviStartStreamResponse() {
-}
+NaviStartStreamResponse::~NaviStartStreamResponse() {}
void NaviStartStreamResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_StartStream);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
index 3d74c27535..4b72ff28b4 100644
--- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
@@ -5,12 +5,10 @@ namespace application_manager {
namespace commands {
NaviStopStreamRequest::NaviStopStreamRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviStopStreamRequest::~NaviStopStreamRequest() {
-}
+NaviStopStreamRequest::~NaviStopStreamRequest() {}
void NaviStopStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc
index 0603df6a65..3a7fc75260 100644
--- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc
@@ -35,16 +35,14 @@ namespace application_manager {
namespace commands {
-NaviStopStreamResponse::NaviStopStreamResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+NaviStopStreamResponse::NaviStopStreamResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviStopStreamResponse::~NaviStopStreamResponse() {
-}
+NaviStopStreamResponse::~NaviStopStreamResponse() {}
void NaviStopStreamResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
}
} // namespace commands
diff --git a/src/components/application_manager/test/mock/src/application_manager_impl.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc
index b5d80e740a..f2106c8724 100644
--- a/src/components/application_manager/test/mock/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.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,4 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/commands/hmi/navi_subscribe_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
+
+NaviSubscribeWayPointsRequest::~NaviSubscribeWayPointsRequest() {}
+
+void NaviSubscribeWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc
index 5f47c2908a..f641051560 100644
--- a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_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
@@ -30,35 +30,29 @@
* 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"
+#include "application_manager/commands/hmi/navi_subscribe_way_points_response.h"
+#include "application_manager/event_engine/event.h"
+#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-namespace hmi {
+NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-OnPhoneCallNotification::OnPhoneCallNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
-
-OnPhoneCallNotification::~OnPhoneCallNotification() {
-}
+NaviSubscribeWayPointsResponse::~NaviSubscribeWayPointsResponse() {}
-void OnPhoneCallNotification::Run() {
+void NaviSubscribeWayPointsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnPhoneCall);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::Navigation_SubscribeWayPoints);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
-} // namespace hmi
-
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc
new file mode 100644
index 0000000000..e66069feef
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc
@@ -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.
+ */
+
+#include "application_manager/commands/hmi/navi_unsubscribe_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+NaviUnSubscribeWayPointsRequest::NaviUnSubscribeWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
+
+NaviUnSubscribeWayPointsRequest::~NaviUnSubscribeWayPointsRequest() {}
+
+void NaviUnSubscribeWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc
new file mode 100644
index 0000000000..61216321e8
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc
@@ -0,0 +1,59 @@
+/*
+ * 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/commands/hmi/navi_unsubscribe_way_points_response.h"
+#include "application_manager/event_engine/event.h"
+#include "interfaces/MOBILE_API.h"
+#include "interfaces/HMI_API.h"
+
+namespace application_manager {
+
+namespace commands {
+
+NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
+
+NaviUnsubscribeWayPointsResponse::~NaviUnsubscribeWayPointsResponse() {}
+
+void NaviUnsubscribeWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc
index 37037245fa..c37c3d12f9 100644
--- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc
@@ -37,11 +37,10 @@ namespace application_manager {
namespace commands {
NaviUpdateTurnListRequest::NaviUpdateTurnListRequest(
- const MessageSharedPtr& message) : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {
-}
+NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {}
void NaviUpdateTurnListRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void NaviUpdateTurnListRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc
index d196db93e9..faf5719d05 100644
--- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/navi_update_turn_list_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/MOBILE_API.h"
namespace application_manager {
@@ -38,18 +39,17 @@ namespace application_manager {
namespace commands {
NaviUpdateTurnListResponse::NaviUpdateTurnListResponse(
- const MessageSharedPtr& message) : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {
-}
+NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {}
void NaviUpdateTurnListResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
index 9c483459e1..64eb63fde8 100644
--- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
@@ -31,22 +31,21 @@
*/
#include "application_manager/commands/hmi/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
namespace commands {
-NotificationFromHMI::NotificationFromHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
-
+NotificationFromHMI::NotificationFromHMI(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {
// Replace HMI app id with Mobile connection id
- ApplicationManagerImpl::instance()->ReplaceHMIByMobileAppId(*message);
+ ReplaceHMIByMobileAppId(*message);
}
-NotificationFromHMI::~NotificationFromHMI() {
-}
+NotificationFromHMI::~NotificationFromHMI() {}
bool NotificationFromHMI::Init() {
return true;
@@ -56,21 +55,18 @@ bool NotificationFromHMI::CleanUp() {
return true;
}
-void NotificationFromHMI::Run() {
-}
+void NotificationFromHMI::Run() {}
void NotificationFromHMI::SendNotificationToMobile(
const MessageSharedPtr& message) {
-
(*message)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
- ApplicationManagerImpl::instance()->ManageMobileCommand(message);
+ application_manager_.ManageMobileCommand(message, ORIGIN_SDL);
}
void NotificationFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const {
-
smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
@@ -78,8 +74,8 @@ void NotificationFromHMI::CreateHMIRequest(
}
// get hmi correlation id for chaining further request from this object
- const uint32_t hmi_correlation_id_ = ApplicationManagerImpl::instance()
- ->GetNextHMICorrelationID();
+ const uint32_t hmi_correlation_id_ =
+ application_manager_.GetNextHMICorrelationID();
NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
request[strings::params][strings::message_type] =
@@ -94,7 +90,7 @@ void NotificationFromHMI::CreateHMIRequest(
request[strings::msg_params] = msg_params;
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(result)) {
+ if (!application_manager_.ManageHMICommand(result)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
return;
}
diff --git a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
index e4f8920ec9..f1e933b7ef 100644
--- a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
@@ -31,21 +31,20 @@
*/
#include "application_manager/commands/hmi/notification_to_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
-
+NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {
// Replace Mobile connection id with HMI app id
- ApplicationManagerImpl::instance()->ReplaceMobileByHMIAppId(*(message.get()));
+ ReplaceMobileByHMIAppId(*(message.get()));
}
-NotificationToHMI::~NotificationToHMI() {
-}
+NotificationToHMI::~NotificationToHMI() {}
bool NotificationToHMI::Init() {
return true;
@@ -55,13 +54,12 @@ bool NotificationToHMI::CleanUp() {
return true;
}
-void NotificationToHMI::Run() {
-}
+void NotificationToHMI::Run() {}
void NotificationToHMI::SendNotification() {
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
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..70e5e7cefd 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
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/on_allow_sdl_functionality_notification.h"
+#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler.h"
namespace application_manager {
@@ -38,20 +39,18 @@ namespace application_manager {
namespace commands {
OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-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(
+ application_manager_.GetPolicyHandler().OnAllowSDLFunctionalityNotification(
(*message_)[strings::msg_params][hmi_response::allowed].asBool(),
device_id);
}
@@ -59,4 +58,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..76252a50fd 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
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_app_activated_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
@@ -40,22 +40,19 @@ namespace application_manager {
namespace commands {
OnAppActivatedNotification::OnAppActivatedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnAppActivatedNotification::~OnAppActivatedNotification() {
-}
+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(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
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..86ce6a830c 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
@@ -31,10 +31,10 @@
*/
#include "application_manager/commands/hmi/on_app_deactivated_notification.h"
-#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 {
@@ -42,77 +42,19 @@ namespace application_manager {
namespace commands {
OnAppDeactivatedNotification::OnAppDeactivatedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {
-}
+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(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc
index c786b486f4..fa7293513a 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
OnAppPermissionChangedNotification::OnAppPermissionChangedNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {
-}
+OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {}
void OnAppPermissionChangedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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..0efc1aee8a 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
@@ -32,20 +32,19 @@
*/
#include "application_manager/commands/hmi/on_app_permission_consent_notification.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/message_helper.h"
+#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
namespace commands {
-OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-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);
+ application_manager_.GetPolicyHandler().OnAppPermissionConsent(
+ connection_key, permission_consent);
}
}
diff --git a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc
index af3f45fed0..a97e19b556 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc
@@ -31,30 +31,28 @@
*/
#include "application_manager/commands/hmi/on_app_registered_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnAppRegisteredNotification::OnAppRegisteredNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnAppRegisteredNotification::~OnAppRegisteredNotification() {
-}
+OnAppRegisteredNotification::~OnAppRegisteredNotification() {}
void OnAppRegisteredNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
// SDL must notify system about app registration before any dependent actions
// will be started
SendNotification();
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc
index 571c6f381c..10ea1ea303 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_app_unregistered_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/event_engine/event.h"
namespace application_manager {
@@ -39,19 +39,19 @@ namespace application_manager {
namespace commands {
OnAppUnregisteredNotification::OnAppUnregisteredNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {
-}
+OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {}
void OnAppUnregisteredNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- //sending event for delete VRCommand on PerformInteraction
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered);
+ // sending event for delete VRCommand on PerformInteraction
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
SendNotification();
}
@@ -59,4 +59,3 @@ void OnAppUnregisteredNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc
index d94d298509..c3e81bdc30 100644
--- a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
OnAudioDataStreamingNotification::OnAudioDataStreamingNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {
-}
+OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {}
void OnAudioDataStreamingNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +50,3 @@ void OnAudioDataStreamingNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc
index 2beffc2bdd..fc8d5989a1 100644
--- a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_button_event_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "utils/logger.h"
@@ -42,8 +42,8 @@ namespace commands {
namespace hmi {
OnButtonEventNotification::OnButtonEventNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
void OnButtonEventNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -59,4 +59,3 @@ void OnButtonEventNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc
index 261aa68ee7..abff87c962 100644
--- a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_button_press_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "utils/logger.h"
#include "application_manager/event_engine/event.h"
@@ -43,14 +43,14 @@ namespace commands {
namespace hmi {
OnButtonPressNotification::OnButtonPressNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
void OnButtonPressNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
(*message_)[strings::params][strings::function_id] =
static_cast<int>(mobile_apis::FunctionID::eType::OnButtonPressID);
SendNotificationToMobile(message_);
@@ -61,4 +61,3 @@ void OnButtonPressNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc
index 3c31de054e..aae994ea34 100644
--- a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc
@@ -39,11 +39,10 @@ namespace commands {
namespace hmi {
OnButtonSubscriptionNotification::OnButtonSubscriptionNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {
-}
+OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {}
void OnButtonSubscriptionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -56,4 +55,3 @@ void OnButtonSubscriptionNotification::Run() {
} // namespace commands
} // namespace application_manager
-
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..83ec785a9d 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
@@ -31,24 +31,22 @@
*/
#include "application_manager/commands/hmi/on_device_chosen_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnDeviceChosenNotification::OnDeviceChosenNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnDeviceChosenNotification::~OnDeviceChosenNotification() {
-}
+OnDeviceChosenNotification::~OnDeviceChosenNotification() {}
void OnDeviceChosenNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
if ((*message_)[strings::msg_params].keyExists(strings::device_info)) {
- ApplicationManagerImpl::instance()->ConnectToDevice(
+ application_manager_.ConnectToDevice(
(*message_)[strings::msg_params][strings::device_info][strings::id]
.asString());
}
@@ -57,4 +55,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..346c05032b 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
@@ -32,44 +32,46 @@
#include <algorithm>
#include "application_manager/commands/hmi/on_device_state_changed_notification.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#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,35 +79,34 @@ namespace application_manager {
namespace commands {
OnDeviceStateChangedNotification::OnDeviceStateChangedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-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);
+ application_manager_.GetPolicyHandler().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..4c322c456f 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
@@ -32,7 +32,7 @@
#include <set>
#include "application_manager/commands/hmi/on_driver_distraction_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -44,27 +44,24 @@ namespace commands {
namespace hmi {
OnDriverDistractionNotification::OnDriverDistractionNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-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());
- ApplicationManagerImpl::instance()->set_driver_distraction(state);
+ (*message_)[strings::msg_params][hmi_notification::state].asInt());
+ application_manager_.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;
}
@@ -74,15 +71,15 @@ void OnDriverDistractionNotification::Run() {
(*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
state;
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet applications = accessor.applications();
+ const ApplicationSet applications =
+ application_manager_.applications().GetData();
- 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..c211ffde50 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,30 +30,26 @@
* 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(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnEventChangedNotification::OnEventChangedNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-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();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
index 7c09800d21..682093cef9 100644
--- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
@@ -36,20 +36,19 @@
#include <unistd.h>
#include <signal.h>
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "interfaces/HMI_API.h"
-
namespace application_manager {
namespace commands {
OnExitAllApplicationsNotification::OnExitAllApplicationsNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {
-}
+OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {}
void OnExitAllApplicationsNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -62,8 +61,6 @@ void OnExitAllApplicationsNotification::Run() {
mobile_api::AppInterfaceUnregisteredReason::eType mob_reason =
mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM;
- ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance();
-
switch (reason) {
case hmi_apis::Common_ApplicationsCloseReason::IGNITION_OFF: {
mob_reason = mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF;
@@ -81,17 +78,18 @@ void OnExitAllApplicationsNotification::Run() {
SendOnSDLPersistenceComplete();
return;
}
- default : {
+ default: {
LOG4CXX_ERROR(logger_, "Unknown Application close reason" << reason);
return;
}
}
- app_manager->SetUnregisterAllApplicationsReason(mob_reason);
+ application_manager_.SetUnregisterAllApplicationsReason(mob_reason);
if (mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET == mob_reason ||
- mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS == mob_reason) {
- app_manager->HeadUnitReset(mob_reason);
+ mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS ==
+ mob_reason) {
+ application_manager_.HeadUnitReset(mob_reason);
}
kill(getpid(), SIGINT);
}
@@ -103,14 +101,14 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() {
new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete;
- (*message)[strings::params][strings::message_type] = MessageType::kNotification;
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
(*message)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ application_manager_.GetNextHMICorrelationID();
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
+ application_manager_.ManageHMICommand(message);
}
} // namespace commands
} // 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..a7b6b9a2cd 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
@@ -31,8 +31,9 @@
*/
#include "application_manager/commands/hmi/on_exit_application_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -42,39 +43,70 @@ namespace application_manager {
namespace commands {
OnExitApplicationNotification::OnExitApplicationNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnExitApplicationNotification::~OnExitApplicationNotification() {
-}
+OnExitApplicationNotification::~OnExitApplicationNotification() {}
void OnExitApplicationNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance();
- ApplicationSharedPtr app_impl = app_mgr->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+
+ uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt();
+ ApplicationSharedPtr app_impl = application_manager_.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: {
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id,
+ AppInterfaceUnregisteredReason::DRIVER_DISTRACTION_VIOLATION),
+ commands::Command::ORIGIN_SDL);
break;
}
- default : {
- LOG4CXX_WARN(logger_, "Unhandled reason");
+ case Common_ApplicationExitReason::USER_EXIT: {
break;
}
+ case Common_ApplicationExitReason::UNAUTHORIZED_TRANSPORT_REGISTRATION: {
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::ORIGIN_SDL);
+ // HMI rejects registration for navi application
+ application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
+ return;
+ }
+ case Common_ApplicationExitReason::UNSUPPORTED_HMI_RESOURCE: {
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, AppInterfaceUnregisteredReason::UNSUPPORTED_HMI_RESOURCE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
+ return;
+ }
+ default: {
+ LOG4CXX_WARN(logger_, "Unhandled reason");
+ return;
+ }
+ }
+ ApplicationSharedPtr app = application_manager_.application(app_id);
+ if (app) {
+ application_manager_.state_controller().SetRegularState(
+ app, HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE, false);
+ } else {
+ LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id);
}
- using namespace mobile_apis;
- ApplicationManagerImpl::instance()->SetState<false>(app_impl->app_id(),
- HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc
index 83c3e61a0c..e69d111d2c 100644
--- a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc
@@ -31,18 +31,16 @@
*/
#include "application_manager/commands/hmi/on_file_removed_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnFileRemovedNotification::OnFileRemovedNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnFileRemovedNotification::~OnFileRemovedNotification() {
-}
+OnFileRemovedNotification::~OnFileRemovedNotification() {}
void OnFileRemovedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void OnFileRemovedNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/src/commands/hmi/on_find_applications.cc
index fc1b72c73a..9d3633ba6d 100644
--- a/src/components/application_manager/src/commands/hmi/on_find_applications.cc
+++ b/src/components/application_manager/src/commands/hmi/on_find_applications.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-OnFindApplications::OnFindApplications(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnFindApplications::OnFindApplications(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnFindApplications::~OnFindApplications() {
-}
+OnFindApplications::~OnFindApplications() {}
void OnFindApplications::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void OnFindApplications::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc
index 32babf05cc..8c772d6dcd 100644
--- a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc
@@ -31,26 +31,23 @@
*/
#include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {
-}
+OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {}
void OnIgnitionCycleOverNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- policy::PolicyHandler::instance()->OnIgnitionCycleOver();
+ application_manager_.GetPolicyHandler().OnIgnitionCycleOver();
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc
index 87db5d4a38..e25de1f3a9 100644
--- a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {
-}
+OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {}
void OnNaviTBTClientStateNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnNaviTBTClientStateNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc
new file mode 100644
index 0000000000..17d1b420be
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc
@@ -0,0 +1,57 @@
+/*
+ * 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/commands/hmi/on_navi_way_point_change_notification.h"
+
+namespace application_manager {
+
+namespace commands {
+
+OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification(
+ const MessageSharedPtr& message, ApplicationManager& app_man)
+ : NotificationFromHMI(message, app_man) {}
+
+OnNaviWayPointChangeNotification::~OnNaviWayPointChangeNotification() {}
+
+void OnNaviWayPointChangeNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // prepare SmartObject for mobile factory
+ (*message_)[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnWayPointChangeID);
+
+ SendNotificationToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_policy_update.cc
index 56c544888a..39b179f967 100644
--- a/src/components/application_manager/src/commands/hmi/on_policy_update.cc
+++ b/src/components/application_manager/src/commands/hmi/on_policy_update.cc
@@ -31,21 +31,20 @@
*/
#include "application_manager/commands/hmi/on_policy_update.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-OnPolicyUpdate::OnPolicyUpdate(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnPolicyUpdate::OnPolicyUpdate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnPolicyUpdate::~OnPolicyUpdate() {
-}
+OnPolicyUpdate::~OnPolicyUpdate() {}
void OnPolicyUpdate::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- policy::PolicyHandler::instance()->OnPTExchangeNeeded();
+ application_manager_.GetPolicyHandler().OnPTExchangeNeeded();
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc
index cf0297df01..596b7d4549 100644
--- a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnPutFileNotification::OnPutFileNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnPutFileNotification::~OnPutFileNotification() {
-}
+OnPutFileNotification::~OnPutFileNotification() {}
void OnPutFileNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void OnPutFileNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/src/commands/hmi/on_ready_notification.cc
index f1ac8b6d3c..3a45e0f934 100644
--- a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ready_notification.cc
@@ -31,29 +31,26 @@
*/
#include "application_manager/commands/hmi/on_ready_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-OnReadyNotification::OnReadyNotification(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnReadyNotification::OnReadyNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnReadyNotification::~OnReadyNotification() {
-}
+OnReadyNotification::~OnReadyNotification() {}
void OnReadyNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->OnHMIStartedCooperation();
+ application_manager_.OnHMIStartedCooperation();
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // 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 f739c762c7..03c0bc7378 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
@@ -32,32 +32,31 @@
#include <string>
#include "application_manager/commands/hmi/on_received_policy_update.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
#include "utils/file_system.h"
namespace application_manager {
namespace commands {
-OnReceivedPolicyUpdate::OnReceivedPolicyUpdate(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnReceivedPolicyUpdate::OnReceivedPolicyUpdate(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {
-}
+OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {}
void OnReceivedPolicyUpdate::Run() {
LOG4CXX_AUTO_TRACE(logger_);
#ifdef EXTENDED_POLICY
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);
+ application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(file_path,
+ file_content);
#else
LOG4CXX_WARN(logger_,
"This RPC is part of extended policy flow."
diff --git a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc
index 163b525628..4d126ac67d 100644
--- a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc
@@ -31,18 +31,16 @@
*/
#include "application_manager/commands/hmi/on_record_start_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnRecordStartdNotification::OnRecordStartdNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnRecordStartdNotification::~OnRecordStartdNotification() {
-}
+OnRecordStartdNotification::~OnRecordStartdNotification() {}
void OnRecordStartdNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void OnRecordStartdNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc
index 8e00c3447c..ce3c371cf8 100644
--- a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnResumeAudioSourceNotification::OnResumeAudioSourceNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {
-}
+OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {}
void OnResumeAudioSourceNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void OnResumeAudioSourceNotification::Run() {
} // namespace commands
} // namespace application_manager
-
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..0517ea8d24 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
@@ -37,14 +37,13 @@ namespace application_manager {
namespace commands {
OnSDLCloseNotification::OnSDLCloseNotification(
- const MessageSharedPtr& message) : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnSDLCloseNotification::~OnSDLCloseNotification() {
-}
+OnSDLCloseNotification::~OnSDLCloseNotification() {}
void OnSDLCloseNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSdlCloseNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
@@ -52,4 +51,3 @@ void OnSDLCloseNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc
index 20010111fd..a9c36813f6 100644
--- a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnSDLConsentNeededNotification::OnSDLConsentNeededNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {
-}
+OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {}
void OnSDLConsentNeededNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void OnSDLConsentNeededNotification::Run() {
} // namespace commands
} // namespace application_manager
-
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..e30a0fb902 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
@@ -37,15 +37,13 @@ namespace application_manager {
namespace commands {
OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {
-}
+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_start_device_discovery.cc b/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc
index 6f867adbcd..8e94b2b004 100644
--- a/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc
+++ b/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc
@@ -31,26 +31,23 @@
*/
#include "application_manager/commands/hmi/on_start_device_discovery.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-OnStartDeviceDiscovery::OnStartDeviceDiscovery(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnStartDeviceDiscovery::OnStartDeviceDiscovery(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {
-}
+OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {}
void OnStartDeviceDiscovery::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->StartDevicesDiscovery();
+ application_manager_.StartDevicesDiscovery();
}
} // namespace commands
} // namespace application_manager
-
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..78a6b68324 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
@@ -37,19 +37,16 @@ namespace application_manager {
namespace commands {
OnStatusUpdateNotification::OnStatusUpdateNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnStatusUpdateNotification::~OnStatusUpdateNotification() {
-}
+OnStatusUpdateNotification::~OnStatusUpdateNotification() {}
void OnStatusUpdateNotification::Run() {
- LOG4CXX_INFO(logger_, "OnGetStatusUpdateNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
} // namespace commands
} // namespace application_manager
-
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..887aacf5b9 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
@@ -31,57 +31,49 @@
*/
#include "application_manager/commands/hmi/on_system_context_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
namespace application_manager {
namespace commands {
OnSystemContextNotification::OnSystemContextNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnSystemContextNotification::~OnSystemContextNotification() {
-}
+OnSystemContextNotification::~OnSystemContextNotification() {}
void OnSystemContextNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
mobile_api::SystemContext::eType system_context =
- static_cast<mobile_api::SystemContext::eType>(
- (*message_)[strings::msg_params][hmi_notification::system_context].asInt());
+ static_cast<mobile_api::SystemContext::eType>(
+ (*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)) {
- app = ApplicationManagerImpl::instance()->active_application();
+ app = application_manager_.active_application();
} else if ((mobile_api::SystemContext::SYSCTXT_ALERT == system_context) ||
(mobile_api::SystemContext::SYSCTXT_MAIN == system_context)) {
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
- app = ApplicationManagerImpl::instance()->
- application((*message_)[strings::msg_params][strings::app_id].asUInt());
+ app = application_manager_.application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
}
}
- 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) {
+ application_manager_.state_controller().SetRegularState(app,
+ 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_system_error_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc
index 09a96cc797..4885420f1c 100644
--- a/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_system_error_notification.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -39,23 +39,20 @@ namespace application_manager {
namespace commands {
OnSystemErrorNotification::OnSystemErrorNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnSystemErrorNotification::~OnSystemErrorNotification() {
-}
+OnSystemErrorNotification::~OnSystemErrorNotification() {}
void OnSystemErrorNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- int code = (*message_)[strings::msg_params][hmi_notification::error]
- .asInt();
+ const int code =
+ (*message_)[strings::msg_params][hmi_notification::error].asInt();
- policy::PolicyHandler::instance()->OnSystemError(code);
+ application_manager_.GetPolicyHandler().OnSystemError(code);
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc
index fb5a9abc43..00b3649284 100644
--- a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_system_info_changed_notification.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace application_manager {
@@ -39,12 +39,10 @@ namespace application_manager {
namespace commands {
OnSystemInfoChangedNotification::OnSystemInfoChangedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {
-}
+OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {}
void OnSystemInfoChangedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,13 +50,11 @@ void OnSystemInfoChangedNotification::Run() {
(*message_)[strings::msg_params][strings::language].asUInt();
const std::string language =
application_manager::MessageHelper::CommonLanguageToString(
- static_cast<hmi_apis::Common_Language::eType>(lang_code));
+ static_cast<hmi_apis::Common_Language::eType>(lang_code));
- policy::PolicyHandler::instance()->OnSystemInfoChanged(language);
+ application_manager_.GetPolicyHandler().OnSystemInfoChanged(language);
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc
index e464037136..b74f1b6799 100644
--- a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc
@@ -31,25 +31,23 @@
*/
#include "application_manager/application_impl.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/commands/hmi/on_system_request_notification.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
-using policy::PolicyHandler;
+using policy::PolicyHandlerInterface;
namespace application_manager {
namespace commands {
OnSystemRequestNotification::OnSystemRequestNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnSystemRequestNotification::~OnSystemRequestNotification() {
-}
+OnSystemRequestNotification::~OnSystemRequestNotification() {}
void OnSystemRequestNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,26 +56,31 @@ void OnSystemRequestNotification::Run() {
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
params[strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID);
+ static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID);
+ // According to HMI API, this should be HMI unique id, but during processing
+ // messages from HMI this param is replaced by connection key, so below it
+ // will be treated as connection key
ApplicationSharedPtr app;
- if (!msg_params.keyExists(strings::app_id)) {
+ if (msg_params.keyExists(strings::app_id)) {
+ const uint32_t app_id = msg_params[strings::app_id].asUInt();
+ LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for appID " << app_id);
+ LOG4CXX_DEBUG(logger_, "Searching app to send OnSystemRequest by appID.");
+ app = application_manager_.application(app_id);
+ } else {
LOG4CXX_DEBUG(logger_,
- "No application specified, trying to choose automatically.");
- PolicyHandler* policy_handler = PolicyHandler::instance();
- uint32_t selected_app_id = policy_handler->GetAppIdForSending();
+ "Received OnSystemRequest without appID."
+ " One of registered apps will be used.");
+ LOG4CXX_DEBUG(logger_, "Searching registered app to send OnSystemRequest.");
+ const PolicyHandlerInterface& policy_handler =
+ application_manager_.GetPolicyHandler();
+ const uint32_t selected_app_id = policy_handler.GetAppIdForSending();
if (0 == selected_app_id) {
LOG4CXX_WARN(logger_,
"Can't select application to forward OnSystemRequest.");
return;
}
- ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance();
- app = app_mgr->application(selected_app_id);
- } else {
- const uint32_t app_id = msg_params[strings::app_id].asUInt();
- LOG4CXX_WARN(logger_, "Looking for application with connection key "
- << app_id);
- app = ApplicationManagerImpl::instance()->application(app_id);
+ app = application_manager_.application(selected_app_id);
}
if (!app.valid()) {
@@ -87,7 +90,7 @@ void OnSystemRequestNotification::Run() {
}
LOG4CXX_DEBUG(logger_,
- "Sending request with application id " << app->mobile_app_id());
+ "Sending request with application id " << app->policy_app_id());
params[strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
@@ -96,4 +99,3 @@ void OnSystemRequestNotification::Run() {
} // 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..bd152c2af0 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
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_tts_language_change_notification.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"
@@ -41,18 +41,15 @@ namespace application_manager {
namespace commands {
OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {
-}
+OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {}
void OnTTSLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_active_tts_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -70,20 +67,22 @@ void OnTTSLanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- ApplicationManagerImpl::ApplicationListAccessor accessor;
-
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ 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()) {
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
- ApplicationManagerImpl::instance()->UnregisterApplication(
+ if (static_cast<int>(app->language()) !=
+ (*message_)[strings::msg_params][strings::language].asInt()) {
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(
app->app_id(), mobile_apis::Result::SUCCESS, false);
}
}
@@ -92,4 +91,3 @@ void OnTTSLanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc
index 96089384c4..283e2056ba 100644
--- a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc
@@ -9,18 +9,17 @@ namespace commands {
namespace hmi {
OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {
-}
+OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {}
void OnTTSResetTimeoutNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace hmi
@@ -28,4 +27,3 @@ void OnTTSResetTimeoutNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc
index dc69246d5c..317465f354 100644
--- a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc
@@ -31,28 +31,24 @@
*/
#include "application_manager/commands/hmi/on_tts_started_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnTTSStartedNotification::OnTTSStartedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnTTSStartedNotification::~OnTTSStartedNotification() {
-}
+OnTTSStartedNotification::~OnTTSStartedNotification() {}
void OnTTSStartedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_Started);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc
index 8d429ed179..7f763d8598 100644
--- a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_tts_stopped_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/event_engine/event.h"
namespace application_manager {
@@ -39,22 +39,19 @@ namespace application_manager {
namespace commands {
OnTTSStoppedNotification::OnTTSStoppedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnTTSStoppedNotification::~OnTTSStoppedNotification() {
-}
+OnTTSStoppedNotification::~OnTTSStoppedNotification() {}
void OnTTSStoppedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc
index d8fe1ebdea..9f91d99a85 100644
--- a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnUICommandNotification::OnUICommandNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUICommandNotification::~OnUICommandNotification() {
-}
+OnUICommandNotification::~OnUICommandNotification() {}
void OnUICommandNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -59,4 +57,3 @@ void OnUICommandNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc
index 9dcfe01e60..117fec5741 100644
--- a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc
@@ -40,18 +40,17 @@ namespace commands {
namespace hmi {
OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {
-}
+OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {}
void OnUIKeyBoardInputNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- //prepare SmartObject for mobile factory
+ // prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnKeyboardInputID;
+ mobile_apis::FunctionID::OnKeyboardInputID;
SendNotificationToMobile(message_);
}
@@ -60,4 +59,3 @@ void OnUIKeyBoardInputNotification::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..6e8e38f757 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
@@ -31,7 +31,7 @@
*/
#include "application_manager/commands/hmi/on_ui_language_change_notification.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"
@@ -41,18 +41,15 @@ namespace application_manager {
namespace commands {
OnUILanguageChangeNotification::OnUILanguageChangeNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {
-}
+OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {}
void OnUILanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_active_ui_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -67,21 +64,24 @@ void OnUILanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- ApplicationManagerImpl::ApplicationListAccessor accessor;
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetConstIt 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()) {
-
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
- ApplicationManagerImpl::instance()->UnregisterApplication(
+ if (app->ui_language() !=
+ (*message_)[strings::msg_params][strings::hmi_display_language]
+ .asInt()) {
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(
app->app_id(), mobile_apis::Result::SUCCESS, false);
}
}
@@ -90,4 +90,3 @@ void OnUILanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc
index 96f65839c1..a5fea7bf8d 100644
--- a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc
@@ -41,18 +41,17 @@ namespace commands {
namespace hmi {
OnUIResetTimeoutNotification::OnUIResetTimeoutNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {
-}
+OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {}
void OnUIResetTimeoutNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace hmi
@@ -60,4 +59,3 @@ void OnUIResetTimeoutNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc
index 00e0e4d2c6..7709af8720 100644
--- a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc
@@ -40,18 +40,17 @@ namespace commands {
namespace hmi {
OnUITouchEventNotification::OnUITouchEventNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUITouchEventNotification::~OnUITouchEventNotification() {
-}
+OnUITouchEventNotification::~OnUITouchEventNotification() {}
void OnUITouchEventNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- //prepare SmartObject for mobile factory
+ // prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnTouchEventID;
+ mobile_apis::FunctionID::OnTouchEventID;
SendNotificationToMobile(message_);
}
@@ -60,4 +59,3 @@ void OnUITouchEventNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/src/commands/hmi/on_update_device_list.cc
index 8716fb4165..b245ea21aa 100644
--- a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc
+++ b/src/components/application_manager/src/commands/hmi/on_update_device_list.cc
@@ -30,18 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/on_update_device_list.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-OnUpdateDeviceList::OnUpdateDeviceList(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnUpdateDeviceList::OnUpdateDeviceList(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnUpdateDeviceList::~OnUpdateDeviceList() {
-}
+OnUpdateDeviceList::~OnUpdateDeviceList() {}
void OnUpdateDeviceList::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -50,4 +48,3 @@ void OnUpdateDeviceList::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
index f1e515e2f2..9b10055e2c 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {
-}
+OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {}
void OnVIAccPedalPositionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIAccPedalPositionNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc
index 0dd5361f74..58f9add514 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIBeltStatusNotification::OnVIBeltStatusNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {
-}
+OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {}
void OnVIBeltStatusNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIBeltStatusNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc
index 27c902c880..33f2944c38 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIBodyInformationNotification::OnVIBodyInformationNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {
-}
+OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {}
void OnVIBodyInformationNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIBodyInformationNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc
index 07b96f1011..9cbf612be1 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIDeviceStatusNotification::OnVIDeviceStatusNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {
-}
+OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {}
void OnVIDeviceStatusNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIDeviceStatusNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc
index 57a8f9c6ef..e521ac3a37 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIDriverBrakingNotification::OnVIDriverBrakingNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {
-}
+OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {}
void OnVIDriverBrakingNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIDriverBrakingNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc
index 7509884497..ebed955270 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIEngineTorqueNotification::OnVIEngineTorqueNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {
-}
+OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {}
void OnVIEngineTorqueNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIEngineTorqueNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc
index 64dd411bdd..9f0696fdc6 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {
-}
+OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {}
void OnVIExternalTemperatureNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIExternalTemperatureNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc
index 59ecab0abc..ef650a9f99 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIFuelLevelNotification::OnVIFuelLevelNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {
-}
+OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {}
void OnVIFuelLevelNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIFuelLevelNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc
index faa8a0522a..a5267d8dac 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {
-}
+OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {}
void OnVIFuelLevelStateNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIFuelLevelStateNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc
index df582418cb..63b95bf6dc 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIGpsDataNotification::OnVIGpsDataNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIGpsDataNotification::~OnVIGpsDataNotification() {
-}
+OnVIGpsDataNotification::~OnVIGpsDataNotification() {}
void OnVIGpsDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIGpsDataNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc
index 01a0a725ef..7d494f02d3 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {
-}
+OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {}
void OnVIHeadLampStatusNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIHeadLampStatusNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
index b13d50fc1c..a62f4cacea 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
@@ -38,12 +38,11 @@ namespace application_manager {
namespace commands {
OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIInstantFuelConsumptionNotification::~OnVIInstantFuelConsumptionNotification() {
-}
+OnVIInstantFuelConsumptionNotification::
+ ~OnVIInstantFuelConsumptionNotification() {}
void OnVIInstantFuelConsumptionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +57,3 @@ void OnVIInstantFuelConsumptionNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc
index 71870522ce..229d50667b 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIMyKeyNotification::OnVIMyKeyNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIMyKeyNotification::~OnVIMyKeyNotification() {
-}
+OnVIMyKeyNotification::~OnVIMyKeyNotification() {}
void OnVIMyKeyNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIMyKeyNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc
index 5db3ef3bb3..10f236539c 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIOdometerNotification::OnVIOdometerNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIOdometerNotification::~OnVIOdometerNotification() {
-}
+OnVIOdometerNotification::~OnVIOdometerNotification() {}
void OnVIOdometerNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIOdometerNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc
index 1739f4809b..81585eabca 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIPrndlNotification::OnVIPrndlNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIPrndlNotification::~OnVIPrndlNotification() {
-}
+OnVIPrndlNotification::~OnVIPrndlNotification() {}
void OnVIPrndlNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIPrndlNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc
index 336847ced0..b5c0703917 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIRpmNotification::OnVIRpmNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIRpmNotification::~OnVIRpmNotification() {
-}
+OnVIRpmNotification::~OnVIRpmNotification() {}
void OnVIRpmNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIRpmNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc
index ad38bf50a5..aacafb71c9 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVISpeedNotification::OnVISpeedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVISpeedNotification::~OnVISpeedNotification() {
-}
+OnVISpeedNotification::~OnVISpeedNotification() {}
void OnVISpeedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVISpeedNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
index 4fd70bf169..af102ea926 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {
-}
+OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {}
void OnVISteeringWheelAngleNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVISteeringWheelAngleNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc
index fda6e6e28d..99506e6171 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVITirePressureNotification::OnVITirePressureNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVITirePressureNotification::~OnVITirePressureNotification() {
-}
+OnVITirePressureNotification::~OnVITirePressureNotification() {}
void OnVITirePressureNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVITirePressureNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
index 15ccf940b8..5f8109ccab 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIVehicleDataNotification::OnVIVehicleDataNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {
-}
+OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {}
void OnVIVehicleDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIVehicleDataNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc
index aa1683c5fb..c360e41dff 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIVinNotification::OnVIVinNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIVinNotification::~OnVIVinNotification() {
-}
+OnVIVinNotification::~OnVIVinNotification() {}
void OnVIVinNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIVinNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc
index 0d27f42388..08fb3f31d4 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVIWiperStatusNotification::OnVIWiperStatusNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {
-}
+OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {}
void OnVIWiperStatusNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -58,4 +56,3 @@ void OnVIWiperStatusNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc
index 12642a75f2..ee0a91f5ef 100644
--- a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnVideoDataStreamingNotification::OnVideoDataStreamingNotification(
- const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationToHMI(message, application_manager) {}
-OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {
-}
+OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {}
void OnVideoDataStreamingNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc
index f8f9b4dfad..c609e2dc0a 100644
--- a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc
@@ -31,9 +31,11 @@
*/
#include "application_manager/commands/hmi/on_vr_command_notification.h"
-#include "application_manager/application_manager_impl.h"
+
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
-#include "config_profile/profile.h"
+#include "application_manager/state_controller.h"
+
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "application_manager/event_engine/event.h"
@@ -43,29 +45,28 @@ namespace application_manager {
namespace commands {
OnVRCommandNotification::OnVRCommandNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVRCommandNotification::~OnVRCommandNotification() {
-}
+OnVRCommandNotification::~OnVRCommandNotification() {}
void OnVRCommandNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationSharedPtr active_app = ApplicationManagerImpl::instance()
- ->active_application();
- const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id]
- .asUInt();
- uint32_t max_cmd_id = profile::Profile::instance()->max_cmd_id();
+ const uint32_t cmd_id =
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt();
+ uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id();
// Check if this is one of standart VR commands (i.e. "Help")
if (cmd_id > max_cmd_id + 1) {
LOG4CXX_INFO(logger_, "Switched App");
const uint32_t app_id = cmd_id - max_cmd_id;
- ApplicationManagerImpl::instance()->SetState<true>(app_id,
- mobile_apis::HMILevel::HMI_FULL
- );
+ ApplicationSharedPtr app = application_manager_.application(app_id);
+ if (app) {
+ application_manager_.state_controller().SetRegularState(
+ app, mobile_apis::HMILevel::HMI_FULL, true);
+ } else {
+ LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id);
+ }
return;
}
@@ -73,9 +74,9 @@ void OnVRCommandNotification::Run() {
if (cmd_id == max_cmd_id + 1) {
return;
}
- const uint32_t app_id = (*message_)[strings::msg_params][strings::app_id]
- .asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ const uint32_t app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+ ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -87,7 +88,7 @@ void OnVRCommandNotification::Run() {
if (0 != app->is_perform_interaction_active()) {
event_engine::Event event(hmi_apis::FunctionID::VR_OnCommand);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
} else {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID);
@@ -101,4 +102,3 @@ void OnVRCommandNotification::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..bbdb55cde6 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
@@ -31,8 +31,9 @@
*/
#include "application_manager/commands/hmi/on_vr_language_change_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
@@ -41,18 +42,15 @@ namespace application_manager {
namespace commands {
OnVRLanguageChangeNotification::OnVRLanguageChangeNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {
-}
+OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {}
void OnVRLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_active_vr_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -64,23 +62,25 @@ void OnVRLanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- ApplicationManagerImpl::ApplicationListAccessor accessor;
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetConstIt 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);
-
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
- ApplicationManagerImpl::instance()->UnregisterApplication(
+ if (static_cast<int32_t>(app->language()) !=
+ (*message_)[strings::msg_params][strings::language].asInt()) {
+ application_manager_.state_controller().SetRegularState(
+ app, mobile_api::HMILevel::HMI_NONE, false);
+
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(
app->app_id(), mobile_apis::Result::SUCCESS, false);
}
}
@@ -89,4 +89,3 @@ void OnVRLanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc
index 85994ad80e..68942fcf01 100644
--- a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc
@@ -31,29 +31,25 @@
*/
#include "application_manager/commands/hmi/on_vr_started_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnVRStartedNotification::OnVRStartedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVRStartedNotification::~OnVRStartedNotification() {
-}
+OnVRStartedNotification::~OnVRStartedNotification() {}
void OnVRStartedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_Started);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc
index 89bdc18eb3..e8f9fab847 100644
--- a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc
@@ -31,29 +31,25 @@
*/
#include "application_manager/commands/hmi/on_vr_stopped_notification.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
OnVRStoppedNotification::OnVRStoppedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVRStoppedNotification::~OnVRStoppedNotification() {
-}
+OnVRStoppedNotification::~OnVRStoppedNotification() {}
void OnVRStoppedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_Stopped);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
index 5713cf2a15..be3cd6314c 100644
--- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
@@ -31,21 +31,22 @@
*/
#include "application_manager/commands/hmi/request_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
+#include "utils/make_shared.h"
namespace application_manager {
namespace commands {
-RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
-
+RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher()) {
// Replace HMI app id with Mobile connection id
- ApplicationManagerImpl::instance()->ReplaceHMIByMobileAppId(*(message.get()));
+ ReplaceHMIByMobileAppId(*(message.get()));
}
-RequestFromHMI::~RequestFromHMI() {
-}
+RequestFromHMI::~RequestFromHMI() {}
bool RequestFromHMI::Init() {
return true;
@@ -55,27 +56,51 @@ bool RequestFromHMI::CleanUp() {
return true;
}
-void RequestFromHMI::Run() {
-}
-
-void RequestFromHMI::on_event(const event_engine::Event& event) {
-}
+void RequestFromHMI::Run() {}
-void RequestFromHMI::SendResponse(uint32_t correlation_id,
- hmi_apis::FunctionID::eType function_id,
- hmi_apis::Common_Result::eType result_code) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+void RequestFromHMI::on_event(const event_engine::Event& event) {}
- (*message)[strings::params][strings::function_id] = function_id;
+void RequestFromHMI::SendResponse(
+ const bool success,
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code) {
+ smart_objects::SmartObject* message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ FillCommonParametersOfSO(message, correlation_id, function_id);
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
- (*message)[strings::params][strings::correlation_id] = correlation_id;
- (*message)[strings::params][hmi_response::code] = result_code;
+ (*message)[strings::params][hmi_response::code] = 0;
+ (*message)[strings::msg_params][strings::success] = success;
+ (*message)[strings::msg_params][strings::result_code] = result_code;
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
+ application_manager_.ManageHMICommand(message);
}
+// void RequestFromHMI::SendErrorResponse(uint32_t correlation_id,
+// hmi_apis::FunctionID::eType
+// function_id,
+// hmi_apis::Common_Result::eType
+// result_code) {
+// smart_objects::SmartObject* message = new smart_objects::SmartObject(
+// smart_objects::SmartType_Map);
+// FillCommonParametersOfSO(message, correlation_id, function_id);
+// (*message)[strings::params][strings::message_type] =
+// MessageType::kErrorResponse;
+// (*message)[strings::params][hmi_response::code] = result_code;
+// (*message)[strings::params][strings::error_msg] = "HMIDeactivate is active";
+
+// application_manager_.ManageHMICommand(message);
+//}
+
+void RequestFromHMI::FillCommonParametersOfSO(
+ smart_objects::SmartObject* message,
+ uint32_t correlation_id,
+ hmi_apis::FunctionID::eType function_id) {
+ (*message)[strings::params][strings::function_id] = function_id;
+ (*message)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] = protocol_version_;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
index 82b36be0f0..2e7d7e9df1 100644
--- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
@@ -31,21 +31,19 @@
*/
#include "application_manager/commands/hmi/request_to_hmi.h"
-#include "application_manager/application_manager_impl.h"
-#include "config_profile/profile.h"
namespace application_manager {
namespace commands {
-RequestToHMI::RequestToHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
+RequestToHMI::RequestToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {
// Replace Mobile connection id with HMI app id
- ApplicationManagerImpl::instance()->ReplaceMobileByHMIAppId(*(message.get()));
+ ReplaceMobileByHMIAppId(*(message.get()));
}
-RequestToHMI::~RequestToHMI() {
-}
+RequestToHMI::~RequestToHMI() {}
bool RequestToHMI::Init() {
return true;
@@ -55,14 +53,13 @@ bool RequestToHMI::CleanUp() {
return true;
}
-void RequestToHMI::Run() {
-}
+void RequestToHMI::Run() {}
void RequestToHMI::SendRequest() {
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
index 9f6ced5974..23d8e6e229 100644
--- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
@@ -31,27 +31,27 @@
*/
#include "application_manager/commands/hmi/response_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+
#include "smart_objects/smart_object.h"
namespace application_manager {
namespace commands {
-ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
- //If it is error response, shift info
+ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {
+ // If it is error response, shift info
if ((*message)[strings::params].keyExists(hmi_response::message)) {
(*message)[strings::msg_params][strings::info] =
(*message)[strings::params][hmi_response::message];
}
// Replace HMI app id with Mobile connection id
- ApplicationManagerImpl::instance()->ReplaceHMIByMobileAppId(*(message.get()));
+ ReplaceHMIByMobileAppId(*(message.get()));
}
-ResponseFromHMI::~ResponseFromHMI() {
-}
+ResponseFromHMI::~ResponseFromHMI() {}
bool ResponseFromHMI::Init() {
return true;
@@ -61,19 +61,18 @@ bool ResponseFromHMI::CleanUp() {
return true;
}
-void ResponseFromHMI::Run() {
-}
+void ResponseFromHMI::Run() {}
-void ResponseFromHMI::SendResponseToMobile(const MessageSharedPtr& message) {
+void ResponseFromHMI::SendResponseToMobile(
+ const MessageSharedPtr& message, ApplicationManager& application_manager) {
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
- ApplicationManagerImpl::instance()->ManageMobileCommand(message);
+ application_manager_.ManageMobileCommand(message, ORIGIN_SDL);
}
void ResponseFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const {
-
smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
@@ -82,8 +81,8 @@ void ResponseFromHMI::CreateHMIRequest(
}
// get hmi correlation id for chaining further request from this object
- const uint32_t hmi_correlation_id_ = ApplicationManagerImpl::instance()
- ->GetNextHMICorrelationID();
+ const uint32_t hmi_correlation_id_ =
+ application_manager_.GetNextHMICorrelationID();
NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
request[strings::params][strings::message_type] = MessageType::kRequest;
@@ -96,7 +95,7 @@ void ResponseFromHMI::CreateHMIRequest(
request[strings::msg_params] = msg_params;
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(result)) {
+ if (!application_manager_.ManageHMICommand(result)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
return;
}
diff --git a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
index d18987428e..e6f64047ba 100644
--- a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
@@ -31,20 +31,20 @@
*/
#include "application_manager/commands/hmi/response_to_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message)
- : CommandImpl(message) {
+ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {
// Replace Mobile connection id with HMI app id
- ApplicationManagerImpl::instance()->ReplaceMobileByHMIAppId(*(message.get()));
+ ReplaceMobileByHMIAppId(*(message.get()));
}
-ResponseToHMI::~ResponseToHMI() {
-}
+ResponseToHMI::~ResponseToHMI() {}
bool ResponseToHMI::Init() {
return true;
@@ -58,9 +58,8 @@ void ResponseToHMI::Run() {
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // 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..30ea41e0b0 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
@@ -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,19 +31,58 @@
*/
#include "application_manager/commands/hmi/sdl_activate_app_request.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
namespace application_manager {
namespace commands {
-SDLActivateAppRequest::SDLActivateAppRequest(const MessageSharedPtr& message)
- : RequestFromHMI(message) {
+namespace {
+struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> {
+ connection_handler::DeviceHandle handle_;
+ ProtoV4AppsOnDevice(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 ForegroundApp
+ : std::unary_function<SDLActivateAppRequest::V4ProtoApps::value_type,
+ bool> {
+ bool operator()(
+ const SDLActivateAppRequest::V4ProtoApps::value_type ptr) const {
+ return ptr ? ptr->is_foreground() : false;
+ }
+};
+
+struct SendLaunchApp
+ : std::unary_function<SDLActivateAppRequest::V4ProtoApps::value_type,
+ void> {
+ ApplicationConstSharedPtr app_to_launch_;
+ ApplicationManager& application_manager_;
+ SendLaunchApp(ApplicationConstSharedPtr app_to_launch, ApplicationManager& am)
+ : app_to_launch_(app_to_launch), application_manager_(am) {}
+ void operator()(
+ const SDLActivateAppRequest::V4ProtoApps::value_type ptr) const {
+ MessageHelper::SendLaunchApp((*ptr).app_id(),
+ app_to_launch_->SchemaUrl(),
+ app_to_launch_->PackageName(),
+ application_manager_);
+ return;
+ }
+};
}
-SDLActivateAppRequest::~SDLActivateAppRequest() {
-}
+SDLActivateAppRequest::SDLActivateAppRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestFromHMI(message, application_manager) {}
+
+SDLActivateAppRequest::~SDLActivateAppRequest() {}
void SDLActivateAppRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,49 +91,73 @@ void SDLActivateAppRequest::Run() {
const uint32_t application_id = app_id();
- ApplicationConstSharedPtr app =
- ApplicationManagerImpl::instance()->application(application_id);
+ ApplicationConstSharedPtr app_to_activate =
+ application_manager_.application(application_id);
+
+ if (!app_to_activate) {
+ LOG4CXX_WARN(
+ logger_,
+ "Can't find application within regular apps: " << application_id);
+
+ // Here is the hack - in fact SDL gets hmi_app_id in appID field and
+ // replaces it with connection_key only for normally registered apps, but
+ // for apps_to_be_registered (waiting) it keeps original value (hmi_app_id)
+ // so method does lookup for hmi_app_id
+ app_to_activate =
+ application_manager_.WaitingApplicationByID(application_id);
+
+ if (!app_to_activate) {
+ LOG4CXX_WARN(
+ logger_,
+ "Can't find application within waiting apps: " << application_id);
+ return;
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Found application to activate. Application id is "
+ << app_to_activate->app_id());
- if (!app) {
- LOG4CXX_WARN(logger_, "Can't find application within regular apps: "
- << application_id);
+ if (app_to_activate->IsRegistered()) {
+ LOG4CXX_DEBUG(logger_, "Application is registered. Activating.");
+ application_manager_.GetPolicyHandler().OnActivateApp(application_id,
+ correlation_id());
+ return;
+ }
- app = ApplicationManagerImpl::instance()->waiting_app(application_id);
+ connection_handler::DeviceHandle device_handle = app_to_activate->device();
+ ApplicationSharedPtr foreground_v4_app = get_foreground_app(device_handle);
+ V4ProtoApps v4_proto_apps = get_v4_proto_apps(device_handle);
- if (!app) {
- LOG4CXX_WARN(logger_, "Can't find application within waiting apps: "
- << application_id);
- return;
- }
+ if (!foreground_v4_app && v4_proto_apps.empty()) {
+ LOG4CXX_ERROR(logger_,
+ "Can't find regular foreground app with the same "
+ "connection id:"
+ << device_handle);
+ SendResponse(false, correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED);
+ return;
}
- if (!app->IsRegistered()) {
- 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);
- return;
- }
- if (devices_apps.first) {
- MessageHelper::SendLaunchApp(devices_apps.first->app_id(),
- app->SchemaUrl(),
- app->PackageName());
- } else {
- 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());
- }
- }
- subscribe_on_event(BasicCommunication_OnAppRegistered);
+ LOG4CXX_DEBUG(logger_,
+ "Application is not registered yet. "
+ "Sending launch request.");
+
+ if (foreground_v4_app) {
+ LOG4CXX_DEBUG(logger_, "Sending request to foreground application.");
+ MessageHelper::SendLaunchApp(foreground_v4_app->app_id(),
+ app_to_activate->SchemaUrl(),
+ app_to_activate->PackageName(),
+ application_manager_);
} else {
- policy::PolicyHandler::instance()->OnActivateApp(application_id,
- correlation_id());
+ LOG4CXX_DEBUG(logger_,
+ "No preffered (foreground) application is found. "
+ "Sending request to all v4 applications.");
+ std::for_each(v4_proto_apps.begin(),
+ v4_proto_apps.end(),
+ SendLaunchApp(app_to_activate, application_manager_));
}
+
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
}
void SDLActivateAppRequest::onTimeOut() {
@@ -102,8 +165,8 @@ 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(
+ false, correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED);
}
void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
@@ -119,64 +182,68 @@ 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_.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(),
- correlation_id());
+ application_manager_.GetPolicyHandler().OnActivateApp(app->app_id(),
+ correlation_id());
}
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();
- }
+ using namespace strings;
+ if (!(*message_).keyExists(msg_params)) {
+ LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message.");
+ return 0;
}
- LOG4CXX_DEBUG(logger_, "app_id section is absent in the message.");
- return 0;
+ if (!(*message_)[msg_params].keyExists(strings::app_id)) {
+ LOG4CXX_DEBUG(logger_,
+ strings::app_id << " section is absent in the message.");
+ return 0;
+ }
+ return (*message_)[msg_params][strings::app_id].asUInt();
}
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();
- }
- }
+ using namespace strings;
+ if (!so.keyExists(params)) {
+ LOG4CXX_DEBUG(logger_, params << " section is absent in the message.");
+ return 0;
}
- LOG4CXX_DEBUG(logger_, "Can't find app_id section is absent in the message.");
- return 0;
+ if (!so[msg_params].keyExists(application)) {
+ LOG4CXX_DEBUG(logger_, application << " section is absent in the message.");
+ return 0;
+ }
+ if (so[msg_params][application].keyExists(strings::app_id)) {
+ LOG4CXX_DEBUG(logger_,
+ strings::app_id << " section is absent in the message.");
+ return 0;
+ }
+ return so[msg_params][application][strings::app_id].asUInt();
}
-DevicesApps
-SDLActivateAppRequest::FindAllAppOnParticularDevice(
- const connection_handler::DeviceHandle handle) {
- DevicesApps apps;
-
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSet app_list = accessor.GetData();
-
- ApplicationManagerImpl::ApplictionSetIt it = app_list.begin();
- ApplicationManagerImpl::ApplictionSetIt it_end = app_list.end();
+SDLActivateAppRequest::V4ProtoApps SDLActivateAppRequest::get_v4_proto_apps(
+ const connection_handler::DeviceHandle handle) const {
+ const ApplicationSet app_list = application_manager_.applications().GetData();
+ V4ProtoApps v4_proto_apps;
+ std::copy_if(app_list.begin(),
+ app_list.end(),
+ std::back_inserter(v4_proto_apps),
+ ProtoV4AppsOnDevice(handle));
+ return v4_proto_apps;
+}
- for (;it != it_end; ++it) {
- if (handle == (*it)->device()) {
- if ((*it)->is_foreground()) {
- apps.first = *it;
- }
- apps.second.push_back(*it);
- }
- }
- return apps;
+ApplicationSharedPtr SDLActivateAppRequest::get_foreground_app(
+ const connection_handler::DeviceHandle handle) const {
+ V4ProtoApps v4_proto_apps = get_v4_proto_apps(handle);
+ V4ProtoApps::iterator foreground_app =
+ std::find_if(v4_proto_apps.begin(), v4_proto_apps.end(), ForegroundApp());
+ return foreground_app != v4_proto_apps.end() ? *foreground_app
+ : ApplicationSharedPtr();
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc
index 6c7a0b5355..75a8c0b241 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc
@@ -31,28 +31,24 @@
*/
#include "application_manager/commands/hmi/sdl_activate_app_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SDLActivateAppResponse::SDLActivateAppResponse(
- const MessageSharedPtr& message): ResponseToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseToHMI(message, application_manager) {}
-SDLActivateAppResponse::~SDLActivateAppResponse() {
-}
+SDLActivateAppResponse::~SDLActivateAppResponse() {}
void SDLActivateAppResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc
index a6649b2579..4b150cda60 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc
@@ -31,19 +31,17 @@
*/
#include "application_manager/commands/hmi/sdl_get_list_of_permissions_request.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest(
- const MessageSharedPtr& message)
- : RequestFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestFromHMI(message, application_manager) {}
-SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {
-}
+SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {}
void SDLGetListOfPermissionsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -51,12 +49,10 @@ void SDLGetListOfPermissionsRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
connection_key = (*message_)[strings::msg_params][strings::app_id].asUInt();
}
- policy::PolicyHandler::instance()->OnGetListOfPermissions(
- connection_key,
- (*message_)[strings::params][strings::correlation_id].asUInt());
+ application_manager_.GetPolicyHandler().OnGetListOfPermissions(
+ connection_key,
+ (*message_)[strings::params][strings::correlation_id].asUInt());
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc
index 5d5e75e5c7..521b59a0ec 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc
@@ -31,28 +31,24 @@
*/
#include "application_manager/commands/hmi/sdl_get_list_of_permissions_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse(
- const MessageSharedPtr& message): ResponseToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseToHMI(message, application_manager) {}
-SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {
-}
+SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {}
void SDLGetListOfPermissionsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc
index dd977d99f0..afa7569746 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc
@@ -31,26 +31,23 @@
*/
#include "application_manager/commands/hmi/sdl_get_status_update_request.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest(const MessageSharedPtr& message)
- : RequestFromHMI(message) {
-}
+SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestFromHMI(message, application_manager) {}
-SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {
-}
+SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {}
void SDLGetStatusUpdateRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- policy::PolicyHandler::instance()->OnGetStatusUpdate(
- (*message_)[strings::params][strings::correlation_id].asUInt());
+ application_manager_.GetPolicyHandler().OnGetStatusUpdate(
+ (*message_)[strings::params][strings::correlation_id].asUInt());
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc
index ab1c57e9af..0af7e0217a 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc
@@ -31,29 +31,24 @@
*/
#include "application_manager/commands/hmi/sdl_get_status_update_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse(
- const MessageSharedPtr& message): ResponseToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseToHMI(message, application_manager) {}
-SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {
-}
+SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {}
void SDLGetStatusUpdateResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
} // namespace application_manager
-
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc
index cdd5c16ed0..ea959389ef 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc
@@ -31,28 +31,24 @@
*/
#include "application_manager/commands/hmi/sdl_get_user_friendly_message_request.h"
-#include "application_manager/application_manager_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/policies/policy_handler.h"
namespace application_manager {
namespace commands {
SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest(
- const MessageSharedPtr& message)
- : RequestFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestFromHMI(message, application_manager) {}
-SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {
-}
+SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {}
void SDLGetUserFriendlyMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
const std::string messageCodes = "messageCodes";
if (!(*message_)[strings::msg_params].keyExists(messageCodes)) {
LOG4CXX_WARN(logger_,
- "Mandatory parameter '"+messageCodes+"'' is missing");
+ "Mandatory parameter '" + messageCodes + "'' is missing");
return;
}
smart_objects::SmartArray* msg =
@@ -68,26 +64,24 @@ void SDLGetUserFriendlyMessageRequest::Run() {
std::string required_language;
if ((*message_)[strings::msg_params].keyExists(strings::language)) {
- uint32_t lang_code = (*message_)[strings::msg_params][strings::language]
- .asUInt();
+ uint32_t lang_code =
+ (*message_)[strings::msg_params][strings::language].asUInt();
required_language =
application_manager::MessageHelper::CommonLanguageToString(
- static_cast<hmi_apis::Common_Language::eType>(lang_code));
+ static_cast<hmi_apis::Common_Language::eType>(lang_code));
} else {
hmi_apis::Common_Language::eType ui_language =
- application_manager::ApplicationManagerImpl::instance()
- ->hmi_capabilities().active_ui_language();
+ application_manager_.hmi_capabilities().active_ui_language();
required_language =
application_manager::MessageHelper::CommonLanguageToString(ui_language);
}
- policy::PolicyHandler::instance()->OnGetUserFriendlyMessage(
- msg_codes, required_language,
- (*message_)[strings::params][strings::correlation_id].asInt());
+ application_manager_.GetPolicyHandler().OnGetUserFriendlyMessage(
+ msg_codes,
+ required_language,
+ (*message_)[strings::params][strings::correlation_id].asInt());
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc
index 8cc1b2d629..c693625dbb 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc
@@ -31,28 +31,24 @@
*/
#include "application_manager/commands/hmi/sdl_get_user_friendly_message_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse(
- const MessageSharedPtr& message): ResponseToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseToHMI(message, application_manager) {}
-SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {
-}
+SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {}
void SDLGetUserFriendlyMessageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
index e1fe835224..e79bca14de 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
@@ -36,8 +36,9 @@ namespace application_manager {
namespace commands {
-SDLPolicyUpdate::SDLPolicyUpdate(const MessageSharedPtr& message)
- : RequestToHMI(message) {}
+SDLPolicyUpdate::SDLPolicyUpdate(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
SDLPolicyUpdate::~SDLPolicyUpdate() {}
diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc
index bc7c6e0d74..38b57a5b9f 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc
@@ -36,11 +36,10 @@ namespace application_manager {
namespace commands {
SDLPolicyUpdateResponse::SDLPolicyUpdateResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {
-}
+SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {}
void SDLPolicyUpdateResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc
index dd127ec43f..bb1f29d889 100644
--- a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
TTSChangeRegistrationRequest::TTSChangeRegistrationRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {
-}
+TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {}
void TTSChangeRegistrationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void TTSChangeRegistrationRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc
index 03b51e5db7..e63ee5f74d 100644
--- a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/tts_change_registration_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
TTSChangeRegistratioResponse::TTSChangeRegistratioResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {
-}
+TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {}
void TTSChangeRegistratioResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc
index fb3dedc1c0..4dbf5e8ee7 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {
-}
+TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {}
void TTSGetCapabilitiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void TTSGetCapabilitiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc
index 53a1bd3916..ce629b36d7 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc
@@ -30,36 +30,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/tts_get_capabilities_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {
-}
+TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {}
void TTSGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
- if ((*message_)[strings::msg_params].keyExists(hmi_response::speech_capabilities)) {
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
+ if ((*message_)[strings::msg_params].keyExists(
+ hmi_response::speech_capabilities)) {
hmi_capabilities.set_speech_capabilities(
- (*message_)[strings::msg_params][hmi_response::speech_capabilities]);
+ (*message_)[strings::msg_params][hmi_response::speech_capabilities]);
}
if ((*message_)[strings::msg_params].keyExists(
- hmi_response::prerecorded_speech_capabilities)) {
+ hmi_response::prerecorded_speech_capabilities)) {
hmi_capabilities.set_prerecorded_speech(
(*message_)[strings::msg_params]
- [hmi_response::prerecorded_speech_capabilities]);
+ [hmi_response::prerecorded_speech_capabilities]);
}
-
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc
index 6d4e4f465a..c44667a223 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-TTSGetLanguageRequest::TTSGetLanguageRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+TTSGetLanguageRequest::TTSGetLanguageRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSGetLanguageRequest::~TTSGetLanguageRequest() {
-}
+TTSGetLanguageRequest::~TTSGetLanguageRequest() {}
void TTSGetLanguageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void TTSGetLanguageRequest::Run() {
} // 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..37aed2c6cb 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
@@ -30,28 +30,40 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#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 {
namespace commands {
-TTSGetLanguageResponse::TTSGetLanguageResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+TTSGetLanguageResponse::TTSGetLanguageResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSGetLanguageResponse::~TTSGetLanguageResponse() {
-}
+TTSGetLanguageResponse::~TTSGetLanguageResponse() {}
void TTSGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
+
+ 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());
+ }
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities().set_active_tts_language(language);
- hmi_capabilities.set_active_tts_language(
- static_cast<hmi_apis::Common_Language::eType>(
- (*message_)[strings::msg_params][hmi_response::language].asInt()));
+ 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(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc
index 5251832bc1..941adca01d 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {
-}
+TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {}
void TTSGetSupportedLanguagesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void TTSGetSupportedLanguagesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc
index a5d022a6cb..79af1d3cc2 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/tts_get_supported_languages_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {
-}
+TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {}
void TTSGetSupportedLanguagesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,8 +51,7 @@ void TTSGetSupportedLanguagesResponse::Run() {
(*message_)[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_tts_supported_languages(
(*message_)[strings::msg_params][hmi_response::languages]);
diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc
index 3a50cfef90..e7fd335808 100644
--- a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-TTSIsReadyRequest::TTSIsReadyRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+TTSIsReadyRequest::TTSIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSIsReadyRequest::~TTSIsReadyRequest() {
-}
+TTSIsReadyRequest::~TTSIsReadyRequest() {}
void TTSIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void TTSIsReadyRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc
index dd8eab7534..91efb293c9 100644
--- a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc
@@ -30,18 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/tts_is_ready_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-TTSIsReadyResponse::TTSIsReadyResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+TTSIsReadyResponse::TTSIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSIsReadyResponse::~TTSIsReadyResponse() {
-}
+TTSIsReadyResponse::~TTSIsReadyResponse() {}
void TTSIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,8 +50,7 @@ void TTSIsReadyResponse::Run() {
is_available = object[strings::msg_params][strings::available].asBool();
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_tts_cooperating(is_available);
}
diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc
index ce330c355f..bf035ffe23 100644
--- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {
-}
+TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {}
void TTSSetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void TTSSetGlobalPropertiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc
index 70dc46d6a6..f494fb1a8e 100644
--- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/tts_set_global_properties_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {
-}
+TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {}
void TTSSetGlobalPropertiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/src/commands/hmi/tts_speak_request.cc
index 79fbde2c4f..2e386449d0 100644
--- a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_speak_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-TTSSpeakRequest::TTSSpeakRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+TTSSpeakRequest::TTSSpeakRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSSpeakRequest::~TTSSpeakRequest() {
-}
+TTSSpeakRequest::~TTSSpeakRequest() {}
void TTSSpeakRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void TTSSpeakRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/src/commands/hmi/tts_speak_response.cc
index ff60115e70..5cffdccf34 100644
--- a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_speak_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/tts_speak_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -38,19 +39,18 @@ namespace application_manager {
namespace commands {
-TTSSpeakResponse::TTSSpeakResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+TTSSpeakResponse::TTSSpeakResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSSpeakResponse::~TTSSpeakResponse() {
-}
+TTSSpeakResponse::~TTSSpeakResponse() {}
void TTSSpeakResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc
index 32aaec27e7..c2275dda72 100644
--- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-TTSStopSpeakingRequest::TTSStopSpeakingRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+TTSStopSpeakingRequest::TTSStopSpeakingRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {
-}
+TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {}
void TTSStopSpeakingRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void TTSStopSpeakingRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc
index b32cf52bb5..67d747f464 100644
--- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
TTSStopSpeakingResponse::TTSStopSpeakingResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {
-}
+TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {}
void TTSStopSpeakingResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc
index ed9f7979a1..c0edad3f80 100644
--- a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIAddCommandRequest::UIAddCommandRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIAddCommandRequest::UIAddCommandRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIAddCommandRequest::~UIAddCommandRequest() {
-}
+UIAddCommandRequest::~UIAddCommandRequest() {}
void UIAddCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIAddCommandRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc
index 13b2ab1b2b..a7eaabc91e 100644
--- a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc
@@ -37,19 +37,18 @@ namespace application_manager {
namespace commands {
-UIAddCommandResponse::UIAddCommandResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIAddCommandResponse::UIAddCommandResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIAddCommandResponse::~UIAddCommandResponse() {
-}
+UIAddCommandResponse::~UIAddCommandResponse() {}
void UIAddCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // 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..f0a233853c 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
@@ -36,15 +36,14 @@ namespace application_manager {
namespace commands {
-UIAddSubmenuRequest::UIAddSubmenuRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIAddSubmenuRequest::UIAddSubmenuRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIAddSubmenuRequest::~UIAddSubmenuRequest() {
-}
+UIAddSubmenuRequest::~UIAddSubmenuRequest() {}
void UIAddSubmenuRequest::Run() {
- LOG4CXX_INFO(logger_, "UIAddCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
@@ -52,4 +51,3 @@ void UIAddSubmenuRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc
index 54247dbbce..6c6c18cbad 100644
--- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc
@@ -31,25 +31,25 @@
*/
#include "application_manager/commands/hmi/ui_add_submenu_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-UIAddSubmenuResponse::UIAddSubmenuResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIAddSubmenuResponse::UIAddSubmenuResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIAddSubmenuResponse::~UIAddSubmenuResponse() {
-}
+UIAddSubmenuResponse::~UIAddSubmenuResponse() {}
void UIAddSubmenuResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/src/commands/hmi/ui_alert_request.cc
index c706d5fdba..44673d4981 100644
--- a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_alert_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIAlertRequest::UIAlertRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIAlertRequest::UIAlertRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIAlertRequest::~UIAlertRequest() {
-}
+UIAlertRequest::~UIAlertRequest() {}
void UIAlertRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIAlertRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/src/commands/hmi/ui_alert_response.cc
index 8c9ddef7ac..6d552a1eb7 100644
--- a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_alert_response.cc
@@ -31,25 +31,25 @@
*/
#include "application_manager/commands/hmi/ui_alert_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-UIAlertResponse::UIAlertResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIAlertResponse::UIAlertResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIAlertResponse::~UIAlertResponse() {
-}
+UIAlertResponse::~UIAlertResponse() {}
void UIAlertResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Alert);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc
index 67c9be6cb5..dcc88125fc 100644
--- a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIChangeRegistrationRequest::UIChangeRegistrationRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {
-}
+UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {}
void UIChangeRegistrationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIChangeRegistrationRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc
index 1d59d66d74..52805a93c8 100644
--- a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/ui_change_registration_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
UIChangeRegistratioResponse::UIChangeRegistratioResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {
-}
+UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {}
void UIChangeRegistratioResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc
index 7d5532f30f..7bd529e8dc 100644
--- a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIDeleteCommandRequest::UIDeleteCommandRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIDeleteCommandRequest::UIDeleteCommandRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIDeleteCommandRequest::~UIDeleteCommandRequest() {
-}
+UIDeleteCommandRequest::~UIDeleteCommandRequest() {}
void UIDeleteCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIDeleteCommandRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc
index 2fb94a63a3..74a1bd64c2 100644
--- a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/ui_delete_command_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
UIDeleteCommandResponse::UIDeleteCommandResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIDeleteCommandResponse::~UIDeleteCommandResponse() {
-}
+UIDeleteCommandResponse::~UIDeleteCommandResponse() {}
void UIDeleteCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc
index e945139639..335d97eee4 100644
--- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIDeleteSubmenuRequest::UIDeleteSubmenuRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIDeleteSubmenuRequest::UIDeleteSubmenuRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {
-}
+UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {}
void UIDeleteSubmenuRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIDeleteSubmenuRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc
index 89a5a19a0b..302343da5e 100644
--- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/ui_delete_submenu_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
UIDeleteSubmenuResponse::UIDeleteSubmenuResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {
-}
+UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {}
void UIDeleteSubmenuResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc
index b87e1d89b8..e1cd11f922 100644
--- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIEndAudioPassThruRequest::UIEndAudioPassThruRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {
-}
+UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {}
void UIEndAudioPassThruRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIEndAudioPassThruRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc
index 8f5d92b78f..e9eb596b85 100644
--- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/ui_end_audio_pass_thru_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,19 +39,17 @@ namespace application_manager {
namespace commands {
UIEndAudioPassThruResponse::UIEndAudioPassThruResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {
-}
+UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {}
void UIEndAudioPassThruResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc
index 74ee67e884..0ae4258d6b 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIGetCapabilitiesRequest::UIGetCapabilitiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {
-}
+UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {}
void UIGetCapabilitiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIGetCapabilitiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc
index b62f24cc51..de0a2f2157 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc
@@ -30,25 +30,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/ui_get_capabilities_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
UIGetCapabilitiesResponse::UIGetCapabilitiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {
-}
+UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {}
void UIGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -83,7 +79,6 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[strings::hmi_capabilities][strings::phone_call].asBool());
}
}
-
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc
index 1b22a9b58f..59d9eef6e3 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIGetLanguageRequest::UIGetLanguageRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIGetLanguageRequest::UIGetLanguageRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIGetLanguageRequest::~UIGetLanguageRequest() {
-}
+UIGetLanguageRequest::~UIGetLanguageRequest() {}
void UIGetLanguageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIGetLanguageRequest::Run() {
} // namespace commands
} // namespace application_manager
-
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..dfbdb89804 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
@@ -30,29 +30,41 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#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 {
namespace commands {
-UIGetLanguageResponse::UIGetLanguageResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIGetLanguageResponse::UIGetLanguageResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIGetLanguageResponse::~UIGetLanguageResponse() {
-}
+UIGetLanguageResponse::~UIGetLanguageResponse() {}
void UIGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
+
+ 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());
+ }
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities().set_active_ui_language(language);
- hmi_capabilities.set_active_ui_language(
- static_cast<hmi_apis::Common_Language::eType>(
- (*message_)[strings::msg_params][hmi_response::language].asInt()));
+ 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(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc
index 5cd0c09e65..598ff39f79 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {
-}
+UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {}
void UIGetSupportedLanguagesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIGetSupportedLanguagesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc
index 2057f3cbb2..e5849f5f63 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/ui_get_supported_languages_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {
-}
+UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {}
void UIGetSupportedLanguagesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,8 +51,7 @@ void UIGetSupportedLanguagesResponse::Run() {
(*message_)[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_ui_supported_languages(
(*message_)[strings::msg_params][hmi_response::languages]);
diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc
index 94df3cec7d..463ae9d41d 100644
--- a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIIsReadyRequest::UIIsReadyRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIIsReadyRequest::UIIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIIsReadyRequest::~UIIsReadyRequest() {
-}
+UIIsReadyRequest::~UIIsReadyRequest() {}
void UIIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIIsReadyRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
index 9edf77080e..e7fca943bc 100644
--- a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
@@ -30,18 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/ui_is_ready_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-UIIsReadyResponse::UIIsReadyResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIIsReadyResponse::UIIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIIsReadyResponse::~UIIsReadyResponse() {
-}
+UIIsReadyResponse::~UIIsReadyResponse() {}
void UIIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,8 +50,7 @@ void UIIsReadyResponse::Run() {
is_available = object[strings::msg_params][strings::available].asBool();
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_ui_cooperating(is_available);
}
diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
index 3cf7722b24..a88719d303 100644
--- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {
-}
+UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {}
void UIPerformAudioPassThruRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIPerformAudioPassThruRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
index c8a488e44d..0736cca526 100644
--- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {
-}
+UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {}
void UIPerformAudioPassThruResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc
index 2b1f5ce484..82a900f1ae 100644
--- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIPerformInteractionRequest::UIPerformInteractionRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIPerformInteractionRequest::~UIPerformInteractionRequest() {
-}
+UIPerformInteractionRequest::~UIPerformInteractionRequest() {}
void UIPerformInteractionRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIPerformInteractionRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc
index 25237525da..ea78c0cd66 100644
--- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc
@@ -38,18 +38,16 @@ namespace application_manager {
namespace commands {
UIPerformInteractionResponse::UIPerformInteractionResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIPerformInteractionResponse::~UIPerformInteractionResponse() {
-}
+UIPerformInteractionResponse::~UIPerformInteractionResponse() {}
void UIPerformInteractionResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc
index 911c840ce4..006944d404 100644
--- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UIScrollableMessageRequest::UIScrollableMessageRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIScrollableMessageRequest::~UIScrollableMessageRequest() {
-}
+UIScrollableMessageRequest::~UIScrollableMessageRequest() {}
void UIScrollableMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UIScrollableMessageRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc
index 58c793c3b6..c39a99fc61 100644
--- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
UIScrollableMessageResponse::UIScrollableMessageResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIScrollableMessageResponse::~UIScrollableMessageResponse() {
-}
+UIScrollableMessageResponse::~UIScrollableMessageResponse() {}
void UIScrollableMessageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc
index c4a3b3b3af..2666eedfc8 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UISetAppIconRequest::UISetAppIconRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UISetAppIconRequest::UISetAppIconRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UISetAppIconRequest::~UISetAppIconRequest() {
-}
+UISetAppIconRequest::~UISetAppIconRequest() {}
void UISetAppIconRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UISetAppIconRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc
index 46c10e8f22..18fc5a5761 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc
@@ -37,19 +37,18 @@ namespace application_manager {
namespace commands {
-UISetAppIconResponse::UISetAppIconResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UISetAppIconResponse::UISetAppIconResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UISetAppIconResponse::~UISetAppIconResponse() {
-}
+UISetAppIconResponse::~UISetAppIconResponse() {}
void UISetAppIconResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc
index df9f6cf2a6..cd69c9c8e6 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc
@@ -37,11 +37,10 @@ namespace application_manager {
namespace commands {
UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest(
- const MessageSharedPtr& message): RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {
-}
+UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {}
void UiSetDisplayLayoutRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -51,4 +50,3 @@ void UiSetDisplayLayoutRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc
index f23cc92642..c5a439636f 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc
@@ -39,18 +39,17 @@ namespace application_manager {
namespace commands {
UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {
-}
+UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {}
void UiSetDisplayLayoutResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc
index 39a0e865df..8658a043b0 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {
-}
+UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {}
void UISetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UISetGlobalPropertiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc
index 23173961fb..d10c206a7c 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {
-}
+UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {}
void UISetGlobalPropertiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // 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..c98b7ec028 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
@@ -37,14 +37,12 @@ namespace application_manager {
namespace commands {
UISetIconRequest::UISetIconRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ : RequestToHMI(message) {}
-UISetIconRequest::~UISetIconRequest() {
-}
+UISetIconRequest::~UISetIconRequest() {}
void UISetIconRequest::Run() {
- LOG4CXX_INFO(logger_, "UISetIconRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
@@ -52,4 +50,3 @@ void UISetIconRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc
index 272ff561aa..955cb1d57b 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UISetMediaClockTimerRequest::UISetMediaClockTimerRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {
-}
+UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {}
void UISetMediaClockTimerRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void UISetMediaClockTimerRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc
index ae878bd694..32acef4994 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
UISetMediaClockTimerResponse::UISetMediaClockTimerResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {
-}
+UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {}
void UISetMediaClockTimerResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/src/commands/hmi/ui_show_request.cc
index 65b9894902..9c0e90feff 100644
--- a/src/components/application_manager/src/commands/hmi/ui_show_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_show_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UIShowRequest::UIShowRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UIShowRequest::UIShowRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UIShowRequest::~UIShowRequest() {
-}
+UIShowRequest::~UIShowRequest() {}
void UIShowRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UIShowRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/src/commands/hmi/ui_show_response.cc
index 8d348e6086..333d9e96c5 100644
--- a/src/components/application_manager/src/commands/hmi/ui_show_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_show_response.cc
@@ -36,19 +36,18 @@ namespace application_manager {
namespace commands {
-UIShowResponse::UIShowResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UIShowResponse::UIShowResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UIShowResponse::~UIShowResponse() {
-}
+UIShowResponse::~UIShowResponse() {}
void UIShowResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/src/commands/hmi/ui_slider_request.cc
index c8d3242d98..26e6ed76b0 100644
--- a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_slider_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UISliderRequest::UISliderRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UISliderRequest::UISliderRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UISliderRequest::~UISliderRequest() {
-}
+UISliderRequest::~UISliderRequest() {}
void UISliderRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void UISliderRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/src/commands/hmi/ui_slider_response.cc
index 7837117ebd..091eb50e0d 100644
--- a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_slider_response.cc
@@ -37,19 +37,18 @@ namespace application_manager {
namespace commands {
-UISliderResponse::UISliderResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UISliderResponse::UISliderResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UISliderResponse::~UISliderResponse() {
-}
+UISliderResponse::~UISliderResponse() {}
void UISliderResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Slider);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/src/commands/hmi/update_app_list_request.cc
index 72f65d1a2e..286d269727 100644
--- a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc
+++ b/src/components/application_manager/src/commands/hmi/update_app_list_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UpdateAppListRequest::UpdateAppListRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UpdateAppListRequest::UpdateAppListRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UpdateAppListRequest::~UpdateAppListRequest() {
-}
+UpdateAppListRequest::~UpdateAppListRequest() {}
void UpdateAppListRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,5 +51,3 @@ void UpdateAppListRequest::Run() {
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/src/commands/hmi/update_app_list_response.cc
index 308bce3ad2..6546d03805 100644
--- a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc
+++ b/src/components/application_manager/src/commands/hmi/update_app_list_response.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-UpdateAppListResponse::UpdateAppListResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+UpdateAppListResponse::UpdateAppListResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UpdateAppListResponse::~UpdateAppListResponse() {
-}
+UpdateAppListResponse::~UpdateAppListResponse() {}
void UpdateAppListResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,5 +51,3 @@ void UpdateAppListResponse::Run() {
} // namespace commands
} // namespace application_manager
-
-
diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/src/commands/hmi/update_device_list_request.cc
index 696e2f85c4..74d104b36d 100644
--- a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc
+++ b/src/components/application_manager/src/commands/hmi/update_device_list_request.cc
@@ -31,8 +31,7 @@
*/
#include "application_manager/commands/hmi/update_device_list_request.h"
-#include "application_manager/application_manager_impl.h"
-#include "config_profile/profile.h"
+
#include "interfaces/HMI_API.h"
#include <unistd.h>
@@ -42,21 +41,21 @@ namespace application_manager {
namespace commands {
UpdateDeviceListRequest::UpdateDeviceListRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager)
+ , EventObserver(application_manager_.event_dispatcher()) {}
-UpdateDeviceListRequest::~UpdateDeviceListRequest() {
-}
+UpdateDeviceListRequest::~UpdateDeviceListRequest() {}
void UpdateDeviceListRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(wait_hmi_lock);
// Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
- // Flag conditional compilation for specific customer is used in order to exclude
+ // Flag conditional compilation for specific customer is used in order to
+ // exclude
// hit code to RTC
- if (true == profile::Profile::instance()->launch_hmi()) {
- if (!ApplicationManagerImpl::instance()->IsHMICooperating()) {
+ if (true == application_manager_.get_settings().launch_hmi()) {
+ if (!application_manager_.IsHMICooperating()) {
LOG4CXX_INFO(logger_, "Wait for HMI Cooperation");
subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
termination_condition_.Wait(auto_lock);
@@ -71,13 +70,13 @@ void UpdateDeviceListRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(wait_hmi_lock);
switch (event.id()) {
- case hmi_apis::FunctionID::BasicCommunication_OnReady : {
+ case hmi_apis::FunctionID::BasicCommunication_OnReady: {
LOG4CXX_INFO(logger_, "received OnReady");
unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
termination_condition_.Broadcast();
break;
};
- default : {
+ default: {
LOG4CXX_ERROR(logger_, "Unknown event ");
break;
};
@@ -93,4 +92,3 @@ bool UpdateDeviceListRequest::CleanUp() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/src/commands/hmi/update_device_list_response.cc
index b3e0f9a309..6d9dec92f8 100644
--- a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc
+++ b/src/components/application_manager/src/commands/hmi/update_device_list_response.cc
@@ -36,12 +36,10 @@ namespace application_manager {
namespace commands {
UpdateDeviceListResponse::UpdateDeviceListResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UpdateDeviceListResponse::~UpdateDeviceListResponse() {
-}
+UpdateDeviceListResponse::~UpdateDeviceListResponse() {}
void UpdateDeviceListResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/src/commands/hmi/update_sdl_request.cc
index b03e595e9c..44f7547964 100644
--- a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc
+++ b/src/components/application_manager/src/commands/hmi/update_sdl_request.cc
@@ -32,27 +32,24 @@
*/
#include "application_manager/commands/hmi/update_sdl_request.h"
-#include "application_manager/policies/policy_handler.h"
namespace application_manager {
namespace commands {
-UpdateSDLRequest::UpdateSDLRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+UpdateSDLRequest::UpdateSDLRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-UpdateSDLRequest::~UpdateSDLRequest() {
-}
+UpdateSDLRequest::~UpdateSDLRequest() {}
void UpdateSDLRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- policy::PolicyHandler::instance()->PTExchangeAtUserRequest(
+ application_manager_.GetPolicyHandler().PTExchangeAtUserRequest(
(*message_)[strings::params][strings::correlation_id].asInt());
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/src/commands/hmi/update_sdl_response.cc
index d9c8b6102f..0e8978fe89 100644
--- a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc
+++ b/src/components/application_manager/src/commands/hmi/update_sdl_response.cc
@@ -30,25 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/update_sdl_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-UpdateSDLResponse::UpdateSDLResponse(
- const MessageSharedPtr& message): ResponseFromHMI(message) {
-}
+UpdateSDLResponse::UpdateSDLResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-UpdateSDLResponse::~UpdateSDLResponse() {
-}
+UpdateSDLResponse::~UpdateSDLResponse() {}
void UpdateSDLResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
- ApplicationManagerImpl::instance()->SendMessageToHMI(message_);
+ application_manager_.SendMessageToHMI(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc
index eb9a9841be..5fe81fcbd8 100644
--- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VIDiagnosticMessageRequest::VIDiagnosticMessageRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VIDiagnosticMessageRequest::VIDiagnosticMessageRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {
-}
+VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {}
void VIDiagnosticMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VIDiagnosticMessageRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc
index 4183395e99..e19af75b54 100644
--- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc
@@ -37,19 +37,19 @@ namespace application_manager {
namespace commands {
-VIDiagnosticMessageResponse::VIDiagnosticMessageResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VIDiagnosticMessageResponse::VIDiagnosticMessageResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {
-}
+VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {}
void VIDiagnosticMessageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage);
+ event_engine::Event event(
+ hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc
index a89252ada2..b373471c43 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VIGetDTCsRequest::VIGetDTCsRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VIGetDTCsRequest::VIGetDTCsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIGetDTCsRequest::~VIGetDTCsRequest() {
-}
+VIGetDTCsRequest::~VIGetDTCsRequest() {}
void VIGetDTCsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VIGetDTCsRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc
index c44f5213d2..3e720f9dbc 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc
@@ -37,19 +37,18 @@ namespace application_manager {
namespace commands {
-VIGetDTCsResponse::VIGetDTCsResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VIGetDTCsResponse::VIGetDTCsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIGetDTCsResponse::~VIGetDTCsResponse() {
-}
+VIGetDTCsResponse::~VIGetDTCsResponse() {}
void VIGetDTCsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc
index 37d5ede4b0..05424c4967 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VIGetVehicleDataRequest::VIGetVehicleDataRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {
-}
+VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {}
void VIGetVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VIGetVehicleDataRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc
index 0ed0f7f515..2794f6eddd 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc
@@ -31,27 +31,24 @@
*/
#include "application_manager/commands/hmi/vi_get_vehicle_data_response.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/policies/policy_handler.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
VIGetVehicleDataResponse::VIGetVehicleDataResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {
-}
+VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {}
void VIGetVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
- if ((*message_)[strings::params][strings::message_type]
- == static_cast<int32_t>(hmi_apis::messageType::error_response)) {
+ if ((*message_)[strings::params][strings::message_type] ==
+ static_cast<int32_t>(hmi_apis::messageType::error_response)) {
smart_objects::SmartObject result(smart_objects::SmartType_Map);
if ((*message_)[strings::params].keyExists(strings::data)) {
@@ -73,10 +70,10 @@ void VIGetVehicleDataResponse::Run() {
event.set_smart_object(result);
} else {
event.set_smart_object(*message_);
- policy::PolicyHandler::instance()->OnVehicleDataUpdated(*message_);
+ application_manager_.GetPolicyHandler().OnVehicleDataUpdated(*message_);
}
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc
index 11dd26dfad..64a3831e1c 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VIGetVehicleTypeRequest::VIGetVehicleTypeRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {
-}
+VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {}
void VIGetVehicleTypeRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VIGetVehicleTypeRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc
index 2b5f6b96be..2369eb7eee 100644
--- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc
@@ -30,25 +30,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/vi_get_vehicle_type_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
VIGetVehicleTypeResponse::VIGetVehicleTypeResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {
-}
+VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {}
void VIGetVehicleTypeResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_vehicle_type(
(*message_)[strings::msg_params][hmi_response::vehicle_type]);
diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc
index aae05e0fcc..3ecc2ffe90 100644
--- a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VIIsReadyRequest::VIIsReadyRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VIIsReadyRequest::VIIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIIsReadyRequest::~VIIsReadyRequest() {
-}
+VIIsReadyRequest::~VIIsReadyRequest() {}
void VIIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VIIsReadyRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
index 4a79a6d9b9..91dae226b6 100644
--- a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
@@ -30,19 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/vi_is_ready_response.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/policies/policy_handler.h"
namespace application_manager {
namespace commands {
-VIIsReadyResponse::VIIsReadyResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VIIsReadyResponse::VIIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIIsReadyResponse::~VIIsReadyResponse() {
-}
+VIIsReadyResponse::~VIIsReadyResponse() {}
void VIIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,11 +50,10 @@ void VIIsReadyResponse::Run() {
is_available = object[strings::msg_params][strings::available].asBool();
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_ivi_cooperating(is_available);
- policy::PolicyHandler::instance()->OnVIIsReady();
+ application_manager_.GetPolicyHandler().OnVIIsReady();
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc
index 92a105dde4..d72fcb8157 100644
--- a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VIReadDIDRequest::VIReadDIDRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VIReadDIDRequest::VIReadDIDRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIReadDIDRequest::~VIReadDIDRequest() {
-}
+VIReadDIDRequest::~VIReadDIDRequest() {}
void VIReadDIDRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VIReadDIDRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc
index 675b944272..568a573f88 100644
--- a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc
@@ -31,26 +31,23 @@
*/
#include "application_manager/commands/hmi/vi_read_did_response.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/application_manager_impl.h"
-
namespace application_manager {
namespace commands {
-VIReadDIDResponse::VIReadDIDResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VIReadDIDResponse::VIReadDIDResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIReadDIDResponse::~VIReadDIDResponse() {
-}
+VIReadDIDResponse::~VIReadDIDResponse() {}
void VIReadDIDResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
index 5ad4daea94..5c953334bb 100644
--- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {
-}
+VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {}
void VISubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VISubscribeVehicleDataRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
index 91d9c85382..4df2d9190a 100644
--- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
@@ -37,20 +37,17 @@ namespace application_manager {
namespace commands {
VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {
-}
+VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {}
void VISubscribeVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData
- );
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
index 7c12cbe6f1..2211cde19c 100644
--- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {
-}
+VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {}
void VIUnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VIUnsubscribeVehicleDataRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
index 124b7dacbd..5044f0ef43 100644
--- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
@@ -37,20 +37,17 @@ namespace application_manager {
namespace commands {
VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {
-}
+VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {}
void VIUnsubscribeVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData
- );
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc
index c900df1678..04af05d4e7 100644
--- a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VRAddCommandRequest::VRAddCommandRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VRAddCommandRequest::VRAddCommandRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRAddCommandRequest::~VRAddCommandRequest() {
-}
+VRAddCommandRequest::~VRAddCommandRequest() {}
void VRAddCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VRAddCommandRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc
index 3d34b5c65a..496bd47605 100644
--- a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc
@@ -31,25 +31,25 @@
*/
#include "application_manager/commands/hmi/vr_add_command_response.h"
#include "application_manager/event_engine/event.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-VRAddCommandResponse::VRAddCommandResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VRAddCommandResponse::VRAddCommandResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRAddCommandResponse::~VRAddCommandResponse() {
-}
+VRAddCommandResponse::~VRAddCommandResponse() {}
void VRAddCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc
index fe8ee69021..e64e7cc388 100644
--- a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VRChangeRegistrationRequest::VRChangeRegistrationRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {
-}
+VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {}
void VRChangeRegistrationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VRChangeRegistrationRequest::Run() {
} // namespace commands
} // namespace application_manager
-
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..8084688c15 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
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
VRChangeRegistrationResponse::VRChangeRegistrationResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {
-}
+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_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc
index e3052ae208..1db85529da 100644
--- a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VRDeleteCommandRequest::VRDeleteCommandRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VRDeleteCommandRequest::VRDeleteCommandRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRDeleteCommandRequest::~VRDeleteCommandRequest() {
-}
+VRDeleteCommandRequest::~VRDeleteCommandRequest() {}
void VRDeleteCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VRDeleteCommandRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc
index 8954b1d1b9..08711be2c8 100644
--- a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc
@@ -38,19 +38,17 @@ namespace application_manager {
namespace commands {
VRDeleteCommandResponse::VRDeleteCommandResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRDeleteCommandResponse::~VRDeleteCommandResponse() {
-}
+VRDeleteCommandResponse::~VRDeleteCommandResponse() {}
void VRDeleteCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc
index 58d0a4b3e4..3159380c17 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VRGetCapabilitiesRequest::VRGetCapabilitiesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {
-}
+VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {}
void VRGetCapabilitiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VRGetCapabilitiesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc
index 5ca1d86190..9aa0fc6668 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc
@@ -30,28 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/vr_get_capabilities_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
VRGetCapabilitiesResponse::VRGetCapabilitiesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {
-}
+VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {}
void VRGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_vr_capabilities(
- (*message_)[strings::msg_params][strings::vr_capabilities]);
+ (*message_)[strings::msg_params][strings::vr_capabilities]);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc
index 0b98979418..baf34c8017 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VRGetLanguageRequest::VRGetLanguageRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VRGetLanguageRequest::VRGetLanguageRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRGetLanguageRequest::~VRGetLanguageRequest() {
-}
+VRGetLanguageRequest::~VRGetLanguageRequest() {}
void VRGetLanguageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VRGetLanguageRequest::Run() {
} // namespace commands
} // namespace application_manager
-
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..a55dca44a3 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
@@ -30,28 +30,41 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#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 {
namespace commands {
-VRGetLanguageResponse::VRGetLanguageResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VRGetLanguageResponse::VRGetLanguageResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRGetLanguageResponse::~VRGetLanguageResponse() {
-}
+VRGetLanguageResponse::~VRGetLanguageResponse() {}
void VRGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
+
+ 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());
+ }
+
+ application_manager_.hmi_capabilities().set_active_vr_language(language);
- 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()));
+ 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(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc
index aea97da02d..def4a64699 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {
-}
+VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {}
void VRGetSupportedLanguagesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VRGetSupportedLanguagesRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc
index b1ea89a460..e5a6ed0b86 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/vr_get_supported_languages_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -39,12 +39,10 @@ namespace application_manager {
namespace commands {
VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {
-}
+VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {}
void VRGetSupportedLanguagesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -54,8 +52,7 @@ void VRGetSupportedLanguagesResponse::Run() {
(*message_)[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_vr_supported_languages(
(*message_)[strings::msg_params][hmi_response::languages]);
}
diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc
index a5a3a2b62e..8c5e8bd49b 100644
--- a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc
@@ -36,12 +36,11 @@ namespace application_manager {
namespace commands {
-VRIsReadyRequest::VRIsReadyRequest(const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+VRIsReadyRequest::VRIsReadyRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRIsReadyRequest::~VRIsReadyRequest() {
-}
+VRIsReadyRequest::~VRIsReadyRequest() {}
void VRIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,4 +51,3 @@ void VRIsReadyRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
index a0de7ae33a..617742a28c 100644
--- a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
@@ -30,18 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/commands/hmi/vr_is_ready_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-VRIsReadyResponse::VRIsReadyResponse(const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+VRIsReadyResponse::VRIsReadyResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRIsReadyResponse::~VRIsReadyResponse() {
-}
+VRIsReadyResponse::~VRIsReadyResponse() {}
void VRIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -52,8 +50,7 @@ void VRIsReadyResponse::Run() {
is_available = object[strings::msg_params][strings::available].asBool();
}
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_vr_cooperating(is_available);
}
diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc
index 1791bab57a..c4646e59f4 100644
--- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
VRPerformInteractionRequest::VRPerformInteractionRequest(
- const MessageSharedPtr& message)
- : RequestToHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : RequestToHMI(message, application_manager) {}
-VRPerformInteractionRequest::~VRPerformInteractionRequest() {
-}
+VRPerformInteractionRequest::~VRPerformInteractionRequest() {}
void VRPerformInteractionRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -53,4 +51,3 @@ void VRPerformInteractionRequest::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc
index 8fc22ce872..bb5ceb3755 100644
--- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc
@@ -37,18 +37,16 @@ namespace application_manager {
namespace commands {
VRPerformInteractionResponse::VRPerformInteractionResponse(
- const MessageSharedPtr& message)
- : ResponseFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : ResponseFromHMI(message, application_manager) {}
-VRPerformInteractionResponse::~VRPerformInteractionResponse() {
-}
+VRPerformInteractionResponse::~VRPerformInteractionResponse() {}
void VRPerformInteractionResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction);
event.set_smart_object(*message_);
- event.raise();
+ event.raise(application_manager_.event_dispatcher());
}
} // 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..03bdfadd66 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
@@ -33,27 +33,30 @@
#include <string>
#include "application_manager/commands/mobile/add_command_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 "utils/helpers.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
-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) {
-}
+namespace custom_str = utils::custom_string;
-AddCommandRequest::~AddCommandRequest() {
-}
+AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , 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() {}
void AddCommandRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -64,43 +67,43 @@ void AddCommandRequest::onTimeOut() {
void AddCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*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,
+ application_manager_);
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 +111,21 @@ 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 +135,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 +159,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 +171,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 +205,28 @@ 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,12 @@ 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,11 +291,12 @@ 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();
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -299,7 +304,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 +332,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 +443,7 @@ 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 +455,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 +465,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 +481,19 @@ bool AddCommandRequest::BothSend() const {
void AddCommandRequest::RemoveCommand() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- connection_key());
+ ApplicationSharedPtr app = application_manager_.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 +510,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_command_response.cc b/src/components/application_manager/src/commands/mobile/add_command_response.cc
index 51684c065b..fc468f9c57 100644
--- a/src/components/application_manager/src/commands/mobile/add_command_response.cc
+++ b/src/components/application_manager/src/commands/mobile/add_command_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/add_command_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-AddCommandResponse::~AddCommandResponse() {
-}
+AddCommandResponse::~AddCommandResponse() {}
void AddCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // 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..83f137ac19 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
@@ -32,25 +32,24 @@
*/
#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) {
-}
+AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-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 = application_manager_.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());
+ application_manager_.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/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc
index ff37a6a998..1fbdb4e66c 100644
--- a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc
+++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc
@@ -32,24 +32,23 @@
*/
#include "application_manager/commands/mobile/add_sub_menu_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
-AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-AddSubMenuResponse::~AddSubMenuResponse() {
-}
+AddSubMenuResponse::~AddSubMenuResponse() {}
void AddSubMenuResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 cdeccd86f4..ea00bc8d70 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,25 +30,28 @@
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/policies/policy_handler.h"
#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
-AlertManeuverRequest::AlertManeuverRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- tts_speak_result_code_(mobile_apis::Result::INVALID_ENUM),
- navi_alert_maneuver_result_code_(mobile_apis::Result::INVALID_ENUM) {
+AlertManeuverRequest::AlertManeuverRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , tts_speak_result_code_(mobile_apis::Result::INVALID_ENUM)
+ , navi_alert_maneuver_result_code_(mobile_apis::Result::INVALID_ENUM) {
subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
}
-AlertManeuverRequest::~AlertManeuverRequest() {
-}
+AlertManeuverRequest::~AlertManeuverRequest() {}
void AlertManeuverRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -61,7 +63,7 @@ void AlertManeuverRequest::Run() {
return;
}
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (NULL == app.get()) {
@@ -78,10 +80,13 @@ void AlertManeuverRequest::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);
+ MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params],
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!");
@@ -100,25 +105,25 @@ void AlertManeuverRequest::Run() {
}
}
- 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();
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
msg_params[hmi_request::soft_buttons] =
- (*message_)[strings::msg_params][strings::soft_buttons];
- MessageHelper::SubscribeApplicationToSoftButton((*message_)[strings::msg_params],
- app, function_id());
+ (*message_)[strings::msg_params][strings::soft_buttons];
+ MessageHelper::SubscribeApplicationToSoftButton(
+ (*message_)[strings::msg_params], app, function_id());
}
pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver);
- SendHMIRequest(hmi_apis::FunctionID::Navigation_AlertManeuver,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true);
if (tts_is_ok) {
- 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[hmi_request::tts_chunks] =
(*message_)[strings::msg_params][strings::tts_chunks];
@@ -131,9 +136,12 @@ 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;
+ bool is_tts_ok;
+ bool is_no_navi_error;
+ hmi_apis::Common_Result::eType tts_result;
+ hmi_apis::Common_Result::eType navi_result;
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
@@ -143,8 +151,23 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
navi_alert_maneuver_result_code_ =
static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
+ message[strings::params][hmi_response::code].asInt());
+ navi_result =
+ MessageHelper::MobileToHMIResult(navi_alert_maneuver_result_code_);
+ 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 is_navi_success =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ navi_result, hmi_apis::Common_Result::SUCCESS);
+ if (is_navi_success) {
+ info_navi_ =
+ message[strings::msg_params][hmi_response::message].asString();
+ } else {
+ info_navi_ = message[strings::msg_params][strings::info].asString();
+ }
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
@@ -152,55 +175,85 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
pending_requests_.Remove(event_id);
- tts_speak_result_code_ =
- static_cast<mobile_apis::Result::eType>(
+ tts_speak_result_code_ = static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
+ tts_result = MessageHelper::MobileToHMIResult(tts_speak_result_code_);
+
+ 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_tts_success =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ tts_result, hmi_apis::Common_Result::SUCCESS);
+ if (is_tts_success) {
+ info_tts_ =
+ message[strings::msg_params][hmi_response::message].asString();
+ } else {
+ info_tts_ = message[strings::msg_params][strings::info].asString();
+ }
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
- ApplicationManagerImpl::instance()->updateRequestTimeout(
+ application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
- SendResponse(false, result_code, "Received unknown event");
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SendResponse(
+ false, mobile_apis::Result::INVALID_ENUM, "Received unknown event");
return;
}
}
- if (pending_requests_.IsFinal(event_id)) {
+ if (!pending_requests_.IsFinal(event_id)) {
+ LOG4CXX_DEBUG(logger_,
+ "There are some pending responses from HMI."
+ "AlertManeuverRequest still waiting.");
+ return;
+ }
- bool result = ((mobile_apis::Result::SUCCESS == tts_speak_result_code_ ||
- mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_result_code_ ||
- mobile_apis::Result::INVALID_ENUM == tts_speak_result_code_) &&
- mobile_apis::Result::SUCCESS == navi_alert_maneuver_result_code_) ||
- (mobile_apis::Result::SUCCESS == tts_speak_result_code_ &&
- mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- navi_alert_maneuver_result_code_);
+ 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_));
+ 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;
+ std::string return_info;
- if (result && mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- tts_speak_result_code_) {
- result_code = mobile_apis::Result::WARNINGS;
- return_info = "Unsupported phoneme type sent in a prompt";
- }
+ const bool is_tts_or_navi_warning =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::WARNINGS, tts_result, navi_result);
- SendResponse(result, result_code, return_info,
- &(message[strings::msg_params]));
- } else {
- LOG4CXX_INFO(logger_,
- "There are some pending responses from HMI."
- "AlertManeuverRequest still waiting.");
+ 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");
+ }
+
+ if (!info_tts_.empty() && !info_navi_.empty()) {
+ info_tts_ += ". ";
+ }
+ return_info = info_tts_ + info_navi_;
+ bool must_be_empty_info = false;
+ if (return_info.find("\n") != std::string::npos ||
+ return_info.find("\t") != std::string::npos) {
+ must_be_empty_info = true;
}
+ SendResponse(result,
+ result_code,
+ (must_be_empty_info) ? NULL : return_info.c_str(),
+ &(message[strings::msg_params]));
}
bool AlertManeuverRequest::IsWhiteSpaceExist() {
diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc
index 8f9c73267f..2f441594c2 100644
--- a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc
@@ -32,24 +32,23 @@
*/
#include "application_manager/commands/mobile/alert_maneuver_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-AlertManeuverResponse::AlertManeuverResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+AlertManeuverResponse::AlertManeuverResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-AlertManeuverResponse::~AlertManeuverResponse() {
-}
+AlertManeuverResponse::~AlertManeuverResponse() {}
void AlertManeuverResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..53910a05b7 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -37,8 +37,9 @@
#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/policies/policy_handler.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -46,21 +47,21 @@ namespace commands {
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
-AlertRequest::AlertRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(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) {
+AlertRequest::AlertRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , awaiting_ui_alert_response_(false)
+ , awaiting_tts_speak_response_(false)
+ , awaiting_tts_stop_speaking_response_(false)
+ , 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);
}
-AlertRequest::~AlertRequest() {
-}
+AlertRequest::~AlertRequest() {}
bool AlertRequest::Init() {
/* Timeout in milliseconds.
@@ -73,9 +74,11 @@ bool AlertRequest::Init() {
default_timeout_ = def_value;
}
- // If soft buttons are present, SDL will not use initiate timeout tracking for response.
+ // If soft buttons are present, SDL will not use initiate timeout tracking for
+ // response.
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
- LOG4CXX_INFO(logger_, "Request contains soft buttons - request timeout "
+ LOG4CXX_INFO(logger_,
+ "Request contains soft buttons - request timeout "
"will be set to 0.");
default_timeout_ = 0;
}
@@ -86,48 +89,62 @@ bool AlertRequest::Init() {
void AlertRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = (*message_)[strings::params][strings::connection_key]
- .asInt();
+ uint32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asInt();
if (!Validate(app_id)) {
// 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() {
- if (false == (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ 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()) {
case hmi_apis::FunctionID::TTS_OnResetTimeout:
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event"
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_alert_response_);
- ApplicationManagerImpl::instance()->updateRequestTimeout(
+ LOG4CXX_INFO(logger_,
+ "Received UI_OnResetTimeout event "
+ " or TTS_OnResetTimeout event"
+ << awaiting_tts_speak_response_ << " "
+ << awaiting_tts_stop_speaking_response_ << " "
+ << awaiting_ui_alert_response_);
+ application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
@@ -146,10 +163,16 @@ 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 +180,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;
}
@@ -169,62 +192,82 @@ void AlertRequest::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 (!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 = application_manager_.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;
}
if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() &&
app->IsCommandLimitsExceeded(
- static_cast<mobile_apis::FunctionID::eType>(function_id()),
- application_manager::TLimitSource::POLICY_TABLE)) {
+ 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;
}
@@ -233,10 +276,13 @@ bool AlertRequest::Validate(uint32_t app_id) {
return false;
}
- //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);
+ MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params],
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
LOG4CXX_ERROR(logger_, "INVALID_DATA!");
@@ -245,13 +291,13 @@ bool AlertRequest::Validate(uint32_t app_id) {
}
// check if mandatory params(alertText1 and TTSChunk) specified
- if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1))
- && (!(*message_)[strings::msg_params].keyExists(strings::alert_text2))
- && (!(*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");
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
+ if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) &&
+ (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) &&
+ (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) &&
+ (1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) {
+ LOG4CXX_ERROR(logger_, "Mandatory parameters are missing");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
"Mandatory parameters are missing");
return false;
}
@@ -260,21 +306,22 @@ 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 = application_manager_.application(app_id);
- 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[hmi_request::alert_strings] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ msg_params[hmi_request::alert_strings] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
int32_t index = 0;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
hmi_apis::Common_TextFieldName::alertText1;
- msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
- (*message_)[strings::msg_params][strings::alert_text1];
- index++;
+ msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
+ (*message_)[strings::msg_params][strings::alert_text1];
+ index++;
}
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
@@ -287,7 +334,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
hmi_apis::Common_TextFieldName::alertText3;
msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
- (*message_)[strings::msg_params][strings::alert_text3];
+ (*message_)[strings::msg_params][strings::alert_text3];
}
// softButtons
@@ -304,7 +351,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
// NAVI platform progressIndicator
if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) {
msg_params[strings::progress_indicator] =
- (*message_)[strings::msg_params][strings::progress_indicator];
+ (*message_)[strings::msg_params][strings::progress_indicator];
}
// PASA Alert type
@@ -316,44 +363,35 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
// check out if there are alert strings or soft buttons
if (msg_params[hmi_request::alert_strings].length() > 0 ||
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;
@@ -362,7 +400,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() {
str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed");
- return false;
+ return false;
}
}
@@ -370,7 +408,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() {
str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed");
- return false;
+ return false;
}
}
@@ -378,7 +416,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() {
str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed");
- return false;
+ return false;
}
}
@@ -397,8 +435,9 @@ bool AlertRequest::CheckStringsOfAlertRequest() {
}
bool AlertRequest::HasHmiResponsesToWait() {
- return awaiting_ui_alert_response_ || awaiting_tts_speak_response_
- || awaiting_tts_stop_speaking_response_;
+ LOG4CXX_AUTO_TRACE(logger_);
+ return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ ||
+ awaiting_tts_stop_speaking_response_;
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/alert_response.cc b/src/components/application_manager/src/commands/mobile/alert_response.cc
index dac086a8b1..f8ca487eae 100644
--- a/src/components/application_manager/src/commands/mobile/alert_response.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/alert_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -41,17 +41,16 @@ namespace application_manager {
namespace commands {
-AlertResponse::AlertResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+AlertResponse::AlertResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-AlertResponse::~AlertResponse() {
-}
+AlertResponse::~AlertResponse() {}
void AlertResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..63339fdc33 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
@@ -34,33 +34,45 @@
#include <string.h>
#include <algorithm>
#include "application_manager/commands/mobile/change_registration_request.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/application_impl.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) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , 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();
+ const HMICapabilities& hmi_capabilities =
+ application_manager_.hmi_capabilities();
- ApplicationSharedPtr app = instance->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -91,90 +103,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) {
@@ -213,7 +219,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
if (pending_requests_.IsFinal(event_id)) {
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -222,36 +228,37 @@ 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();
+ application_manager_.hmi_capabilities();
const smart_objects::SmartObject* ui_languages =
hmi_capabilities.ui_supported_languages();
@@ -274,7 +281,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
const int32_t& hmi_display_lang) {
const HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities();
const smart_objects::SmartObject* vr_languages =
hmi_capabilities.vr_supported_languages();
@@ -297,7 +304,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
const int32_t& hmi_display_lang) {
const HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities();
const smart_objects::SmartObject* tts_languages =
hmi_capabilities.tts_supported_languages();
@@ -344,10 +351,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");
@@ -379,22 +386,22 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- std::string app_name;
+ ApplicationSet accessor = application_manager_.applications().GetData();
+ 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 +430,57 @@ 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_.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->policy_app_id();
+
+ policy::StringArray app_nicknames;
+ policy::StringArray app_hmi_types;
+
+ bool init_result = application_manager_.GetPolicyHandler().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(
+ application_manager_.GetPolicyHandler().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/change_registration_response.cc b/src/components/application_manager/src/commands/mobile/change_registration_response.cc
index 557614f173..210cae64c5 100644
--- a/src/components/application_manager/src/commands/mobile/change_registration_response.cc
+++ b/src/components/application_manager/src/commands/mobile/change_registration_response.cc
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/change_registration_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
ChangeRegistrationResponse::ChangeRegistrationResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-ChangeRegistrationResponse::~ChangeRegistrationResponse() {
-}
+ChangeRegistrationResponse::~ChangeRegistrationResponse() {}
void ChangeRegistrationResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 0dceaf0fa1..a7bb5ebc0b 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
@@ -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,28 +31,28 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#include "application_manager/commands/mobile/create_interaction_choice_set_request.h"
-#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 {
namespace commands {
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- choice_set_id_(0),
- expected_chs_count_(0),
- received_chs_count_(0),
- error_from_hmi_(false),
- is_timed_out_(false) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , choice_set_id_(0)
+ , expected_chs_count_(0)
+ , received_chs_count_(0)
+ , error_from_hmi_(false)
+ , is_timed_out_(false) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -61,8 +61,7 @@ CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
void CreateInteractionChoiceSetRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -74,31 +73,37 @@ void CreateInteractionChoiceSetRequest::Run() {
++i) {
Result::eType verification_result_image = Result::SUCCESS;
Result::eType verification_result_secondary_image = Result::SUCCESS;
- if ((*message_)[strings::msg_params]
- [strings::choice_set][i].keyExists(strings::image)) {
+ if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists(
+ strings::image)) {
verification_result_image = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::choice_set]
- [i][strings::image], app);
+ (*message_)[strings::msg_params][strings::choice_set][i]
+ [strings::image],
+ app,
+ application_manager_);
}
- if ((*message_)[strings::msg_params]
- [strings::choice_set][i].keyExists(strings::secondary_image)) {
+ if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists(
+ strings::secondary_image)) {
verification_result_secondary_image = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::choice_set]
- [i][strings::secondary_image], app);
+ (*message_)[strings::msg_params][strings::choice_set][i]
+ [strings::secondary_image],
+ app,
+ application_manager_);
}
if (verification_result_image == Result::INVALID_DATA ||
verification_result_secondary_image == Result::INVALID_DATA) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
- SendResponse(false, Result::INVALID_DATA);
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SendResponse(false, Result::INVALID_DATA);
return;
}
}
- choice_set_id_ = (*message_)[strings::msg_params]
- [strings::interaction_choice_set_id].asInt();
+ choice_set_id_ =
+ (*message_)[strings::msg_params][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;
}
@@ -108,134 +113,64 @@ void CreateInteractionChoiceSetRequest::Run() {
SendResponse(false, result);
return;
}
- uint32_t grammar_id = ApplicationManagerImpl::instance()->GenerateGrammarID();
+ uint32_t grammar_id = application_manager_.GenerateGrammarID();
(*message_)[strings::msg_params][strings::grammar_id] = grammar_id;
app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]);
SendVRAddCommandRequests(app);
}
mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
- ApplicationConstSharedPtr app) {
+ 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();
-
- smart_objects::SmartArray::const_iterator it_array =
- new_choice_set_array->begin();
+ std::set<uint32_t> choice_id_set;
- smart_objects::SmartArray::const_iterator it_array_end =
- new_choice_set_array->end();
+ const SmartArray* choice_set =
+ (*message_)[strings::msg_params][strings::choice_set].asArray();
- // 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();
+ SmartArray::const_iterator choice_set_it = choice_set->begin();
- 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))) {
- LOG4CXX_ERROR(logger_,
- "Incoming choice set has contains \t\n \\t \\n");
+ 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;
}
bool CreateInteractionChoiceSetRequest::compareSynonyms(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) {
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) {
smart_objects::SmartArray* vr_cmds_1 =
- choice1[strings::vr_commands].asArray();
+ choice1[strings::vr_commands].asArray();
DCHECK(vr_cmds_1 != NULL);
smart_objects::SmartArray* vr_cmds_2 =
- choice2[strings::vr_commands].asArray();
+ choice2[strings::vr_commands].asArray();
DCHECK(vr_cmds_2 != NULL);
smart_objects::SmartArray::iterator it;
- it = std::find_first_of(vr_cmds_1->begin(), vr_cmds_1->end(),
- vr_cmds_2->begin(), vr_cmds_2->end(),
+ it = std::find_first_of(vr_cmds_1->begin(),
+ vr_cmds_1->end(),
+ vr_cmds_2->begin(),
+ vr_cmds_2->end(),
CreateInteractionChoiceSetRequest::compareStr);
-
if (it != vr_cmds_1->end()) {
- LOG4CXX_INFO(logger_, "Incoming choice set has duplicated VR synonyms "
- << it->asString());
+ LOG4CXX_INFO(logger_,
+ "Incoming choice set has duplicated VR synonyms "
+ << it->asString());
return true;
}
@@ -243,13 +178,13 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms(
}
bool CreateInteractionChoiceSetRequest::compareStr(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) {
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1,
+ const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) {
return 0 == strcasecmp(str1.asCharArray(), str2.asCharArray());
}
bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
- const smart_objects::SmartObject& choice_set) {
+ const smart_objects::SmartObject& choice_set) {
LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
@@ -276,8 +211,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
}
if (choice_set.keyExists(strings::vr_commands)) {
- const size_t len =
- choice_set[strings::vr_commands].length();
+ const size_t len = choice_set[strings::vr_commands].length();
for (size_t i = 0; i < len; ++i) {
str = choice_set[strings::vr_commands][i].asCharArray();
@@ -299,8 +233,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
if (choice_set.keyExists(strings::secondary_image)) {
str = choice_set[strings::secondary_image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid secondary_image value. "
- "Syntax check failed");
+ LOG4CXX_ERROR(logger_,
+ "Invalid secondary_image value. "
+ "Syntax check failed");
return true;
}
}
@@ -308,15 +243,15 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
}
void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
- application_manager::ApplicationSharedPtr const app) {
+ application_manager::ApplicationSharedPtr const app) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params];
- 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::type] = hmi_apis::Common_VRCommandType::Choice;
msg_params[strings::app_id] = app->app_id();
- msg_params[strings::grammar_id] = choice_set[strings::grammar_id];
+ msg_params[strings::grammar_id] = choice_set[strings::grammar_id];
const uint32_t choice_count = choice_set[strings::choice_set].length();
SetAllowedToTerminate(false);
@@ -326,17 +261,18 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
{
sync_primitives::AutoLock error_lock(error_from_hmi_lock_);
if (error_from_hmi_) {
- LOG4CXX_WARN(logger_, "Error from HMI received. Stop sending VRCommands");
+ LOG4CXX_WARN(logger_,
+ "Error from HMI received. Stop sending VRCommands");
break;
}
}
msg_params[strings::cmd_id] =
- choice_set[strings::choice_set][chs_num][strings::choice_id];
- msg_params[strings::vr_commands] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ choice_set[strings::choice_set][chs_num][strings::choice_id];
+ msg_params[strings::vr_commands] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
msg_params[strings::vr_commands] =
- choice_set[strings::choice_set][chs_num][strings::vr_commands];
+ choice_set[strings::choice_set][chs_num][strings::vr_commands];
sync_primitives::AutoLock commands_lock(vr_commands_lock_);
const uint32_t vr_cmd_id = msg_params[strings::cmd_id].asUInt();
@@ -345,8 +281,9 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
VRCommandInfo vr_command(vr_cmd_id);
sent_commands_map_[vr_corr_id] = vr_command;
- LOG4CXX_DEBUG(logger_, "VR_command sent corr_id "
- << vr_corr_id << " cmd_id " << vr_corr_id);
+ LOG4CXX_DEBUG(logger_,
+ "VR_command sent corr_id " << vr_corr_id << " cmd_id "
+ << vr_corr_id);
}
expected_chs_count_ = chs_num;
LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_);
@@ -355,58 +292,60 @@ 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();
if (event.id() == hmi_apis::FunctionID::VR_AddCommand) {
received_chs_count_++;
- LOG4CXX_DEBUG(logger_, "Got VR.AddCommand response, there are "
- << expected_chs_count_ - received_chs_count_
- << " more to wait.");
-
- 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;
- }
+ LOG4CXX_DEBUG(logger_,
+ "Got VR.AddCommand response, there are "
+ << expected_chs_count_ - received_chs_count_
+ << " more to wait.");
- 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_));
+ uint32_t corr_id = static_cast<uint32_t>(
+ message[strings::params][strings::correlation_id].asUInt());
+ {
+ 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;
}
- }
- // 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(
- connection_key(), correlation_id(), default_timeout());
+ 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));
+ }
}
- } else {
- OnAllHMIResponsesReceived();
}
+ if (received_chs_count_ < expected_chs_count_) {
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
+ LOG4CXX_DEBUG(logger_, "Timeout for request was updated");
+ return;
+ }
+ OnAllHMIResponsesReceived();
}
}
void CreateInteractionChoiceSetRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock error_lock(error_from_hmi_lock_);
if (!error_from_hmi_) {
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
}
@@ -416,15 +355,14 @@ void CreateInteractionChoiceSetRequest::onTimeOut() {
// according to SDLAQ-CRS-2976
sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_);
is_timed_out_ = true;
- ApplicationManagerImpl::instance()->TerminateRequest(
- connection_key(), correlation_id());
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
}
void CreateInteractionChoiceSetRequest::DeleteChoices() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -442,9 +380,9 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
msg_param[strings::cmd_id] = vr_command_info.cmd_id_;
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param);
} else {
- LOG4CXX_WARN(
- logger_, "Succesfull response has not been received for cmd_id = "
- << vr_command_info.cmd_id_);
+ LOG4CXX_WARN(logger_,
+ "Succesfull response has not been received for cmd_id = "
+ << vr_command_info.cmd_id_);
}
}
sent_commands_map_.clear();
@@ -457,7 +395,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
SendResponse(true, mobile_apis::Result::SUCCESS);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -466,8 +404,8 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
} else {
DeleteChoices();
}
- ApplicationManagerImpl::instance()->TerminateRequest(connection_key(),
- correlation_id());
+
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc
index bc81206088..0cc137d6a0 100644
--- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc
+++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/create_interaction_choice_set_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -41,12 +41,10 @@ namespace application_manager {
namespace commands {
CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {
-}
+CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {}
void CreateInteractionChoiceSetResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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..9a7b92f7b8 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
@@ -32,51 +32,54 @@
*/
#include "application_manager/commands/mobile/delete_command_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 {
namespace commands {
-DeleteCommandRequest::DeleteCommandRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- is_ui_send_(false),
- is_vr_send_(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) {
-}
+DeleteCommandRequest::DeleteCommandRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , is_ui_send_(false)
+ , is_vr_send_(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) {}
-DeleteCommandRequest::~DeleteCommandRequest() {
-}
+DeleteCommandRequest::~DeleteCommandRequest() {}
void DeleteCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr application =
+ application_manager_.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;
}
- 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] =
(*message_)[strings::msg_params][strings::cmd_id];
@@ -110,74 +113,112 @@ 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: {
- 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()) {
+ LOG4CXX_DEBUG(logger_, "Still awaiting for other responses.");
+ return;
+ }
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
- return;
- }
+ ApplicationSharedPtr application =
+ application_manager_.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_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc
index 75178bcb4d..7abc1c11d4 100644
--- a/src/components/application_manager/src/commands/mobile/delete_command_response.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_command_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/delete_command_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-DeleteCommandResponse::DeleteCommandResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+DeleteCommandResponse::DeleteCommandResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DeleteCommandResponse::~DeleteCommandResponse() {
-}
+DeleteCommandResponse::~DeleteCommandResponse() {}
void DeleteCommandResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc
index 4c753871ce..00d23bb094 100644
--- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_file_request.cc
@@ -32,27 +32,26 @@
*/
#include "application_manager/commands/mobile/delete_file_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
+
#include "utils/file_system.h"
namespace application_manager {
namespace commands {
-DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-DeleteFileRequest::~DeleteFileRequest() {
-}
+DeleteFileRequest::~DeleteFileRequest() {}
void DeleteFileRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -61,20 +60,21 @@ void DeleteFileRequest::Run() {
}
if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
- (profile::Profile::instance()->delete_file_in_none() <=
+ (application_manager_.get_settings().delete_file_in_none() <=
application->delete_file_in_none_count())) {
- // If application is in the HMI_NONE level the quantity of allowed
- // DeleteFile request is limited by the configuration profile
- LOG4CXX_ERROR(logger_, "Too many requests from the app with HMILevel HMI_NONE ");
- SendResponse(false, mobile_apis::Result::REJECTED);
- return;
+ // If application is in the HMI_NONE level the quantity of allowed
+ // DeleteFile request is limited by the configuration profile
+ LOG4CXX_ERROR(logger_,
+ "Too many requests from the app with HMILevel HMI_NONE ");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
}
const std::string& sync_file_name =
(*message_)[strings::msg_params][strings::sync_file_name].asString();
std::string full_file_path =
- profile::Profile::instance()->app_storage_folder() + "/";
+ application_manager_.get_settings().app_storage_folder() + "/";
full_file_path += application->folder_name();
full_file_path += "/";
full_file_path += sync_file_name;
@@ -97,17 +97,16 @@ void DeleteFileRequest::Run() {
}
}
-void DeleteFileRequest::SendFileRemovedNotification(
- const AppFile* file) const {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+void DeleteFileRequest::SendFileRemovedNotification(const AppFile* file) const {
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params[strings::app_id] = connection_key();
- msg_params[strings::file_name] = file->file_name;
- msg_params[strings::file_type] = file->file_type;
+ msg_params[strings::app_id] = connection_key();
+ msg_params[strings::file_name] = file->file_name;
+ msg_params[strings::file_type] = file->file_type;
- CreateHMINotification(
- hmi_apis::FunctionID::BasicCommunication_OnFileRemoved, msg_params);
+ CreateHMINotification(hmi_apis::FunctionID::BasicCommunication_OnFileRemoved,
+ msg_params);
}
} // namespace commands
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..8ed6f7ba2e 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
@@ -32,26 +32,24 @@
*/
#include "application_manager/commands/mobile/delete_file_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
-DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DeleteFileResponse::~DeleteFileResponse() {
-}
+DeleteFileResponse::~DeleteFileResponse() {}
void DeleteFileResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = (*message_)[strings::params][strings::connection_key]
- .asUInt();
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(app_id);
+ uint32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "Application not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -59,8 +57,7 @@ void DeleteFileResponse::Run() {
}
(*message_)[strings::msg_params][strings::space_available] =
- static_cast<int32_t>(
- ApplicationManagerImpl::instance()->GetAvailableSpaceForApp(app->name()));
+ static_cast<uint32_t>(app->GetAvailableDiskSpace());
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..6ef8e5d9da 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
@@ -32,59 +32,60 @@
*/
#include "application_manager/commands/mobile/delete_interaction_choice_set_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+
namespace application_manager {
namespace commands {
DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {
-}
+DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {}
void DeleteInteractionChoiceSetRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app = application_manager_.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 =
- (*message_)[strings::msg_params]
- [strings::interaction_choice_set_id].asInt();
+ 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;
}
SendVrDeleteCommand(app);
- 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::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 +95,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_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc
index f9ee513b94..97e07529af 100644
--- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/delete_interaction_choice_set_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -42,12 +42,10 @@ namespace application_manager {
namespace commands {
DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {
-}
+DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {}
void DeleteInteractionChoiceSetResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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..bdb5521921 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
@@ -32,26 +32,25 @@
*/
#include "application_manager/commands/mobile/delete_sub_menu_request.h"
-#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 {
namespace commands {
-DeleteSubMenuRequest::DeleteSubMenuRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+DeleteSubMenuRequest::DeleteSubMenuRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-DeleteSubMenuRequest::~DeleteSubMenuRequest() {
-}
+DeleteSubMenuRequest::~DeleteSubMenuRequest() {}
void DeleteSubMenuRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -59,15 +58,17 @@ 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;
}
- 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];
@@ -76,7 +77,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();
@@ -84,16 +86,14 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(ApplicationConstSharedPtr app
CommandsMap::const_iterator it = commands.begin();
for (; commands.end() != it; ++it) {
-
if (!(*it->second).keyExists(strings::vr_commands)) {
continue;
}
- if ((*message_)[strings::msg_params][strings::menu_id].asInt()
- == (*it->second)[strings::menu_params]
- [hmi_request::parent_id].asInt()) {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params][strings::menu_id].asInt() ==
+ (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) {
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt();
msg_params[strings::app_id] = app->app_id();
msg_params[strings::grammar_id] = app->get_grammar_id();
@@ -104,7 +104,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());
@@ -118,11 +119,10 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const ap
continue;
}
- if ((*message_)[strings::msg_params][strings::menu_id].asInt()
- == (*it->second)[strings::menu_params]
- [hmi_request::parent_id].asInt()) {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params][strings::menu_id].asInt() ==
+ (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) {
+ 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::cmd_id].asInt();
app->RemoveCommand((*it->second)[strings::cmd_id].asInt());
@@ -138,6 +138,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,10 +147,13 @@ 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());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -162,9 +166,12 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
DeleteSubMenuUICommands(application);
application->RemoveSubMenu(
(*message_)[strings::msg_params][strings::menu_id].asInt());
- }
+ }
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ if (result) {
+ application->UpdateHash();
+ }
break;
}
default: {
@@ -174,7 +181,6 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
}
}
-
} // namespace commands
} // namespace application_manager
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..ad9d2ad858 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
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/delete_sub_menu_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-DeleteSubMenuResponse::DeleteSubMenuResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+DeleteSubMenuResponse::DeleteSubMenuResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DeleteSubMenuResponse::~DeleteSubMenuResponse() {
-}
+DeleteSubMenuResponse::~DeleteSubMenuResponse() {}
void DeleteSubMenuResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..5252ea0e33 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
@@ -33,27 +33,25 @@
#include <algorithm>
#include "application_manager/commands/mobile/diagnostic_message_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-DiagnosticMessageRequest::DiagnosticMessageRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+DiagnosticMessageRequest::DiagnosticMessageRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-DiagnosticMessageRequest::~DiagnosticMessageRequest() {
-}
+DiagnosticMessageRequest::~DiagnosticMessageRequest() {}
void DiagnosticMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered.");
@@ -62,30 +60,31 @@ 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;
- }
+ application_manager_.get_settings().supported_diag_modes();
+
+ 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
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage,
- &(*message_)[strings::msg_params], true);
-
+ &(*message_)[strings::msg_params],
+ true);
}
void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc
index 9c399a00c8..8c59a97a8b 100644
--- a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc
+++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/diagnostic_message_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-DiagnosticMessageResponse::DiagnosticMessageResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+DiagnosticMessageResponse::DiagnosticMessageResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DiagnosticMessageResponse::~DiagnosticMessageResponse() {
-}
+DiagnosticMessageResponse::~DiagnosticMessageResponse() {}
void DiagnosticMessageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 6e8f5e15ad..64685afe2e 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
@@ -33,15 +33,16 @@
#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"
namespace application_manager {
namespace commands {
-DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {}
+DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
DialNumberRequest::~DialNumberRequest() {}
@@ -57,13 +58,14 @@ void DialNumberRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.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)) {
@@ -71,10 +73,11 @@ void DialNumberRequest::Run() {
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");
+ LOG4CXX_ERROR(logger_,
+ "After strip number param is empty. Invalid incoming data");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -89,8 +92,9 @@ void DialNumberRequest::Run() {
}
void DialNumberRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -130,7 +134,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) {
void DialNumberRequest::StripNumberParam(std::string& number) {
std::size_t found = 0;
while (std::string::npos !=
- (found = number.find_first_not_of("+*#,;0123456789"))) {
+ (found = number.find_first_not_of("0123456789*#,;+"))) {
number.erase(number.begin() + found);
}
(*message_)[strings::msg_params][strings::number] = number;
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
index 1daab5a4e1..750dcf25c4 100644
--- a/src/components/application_manager/src/commands/mobile/dial_number_response.cc
+++ b/src/components/application_manager/src/commands/mobile/dial_number_response.cc
@@ -31,21 +31,21 @@
*/
#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(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-DialNumberResponse::~DialNumberResponse() {
-}
+DialNumberResponse::~DialNumberResponse() {}
void DialNumberResponse::Run() {
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
index 78a867a6d8..5a922f595f 100644
--- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -32,19 +32,16 @@
*/
#include "application_manager/commands/mobile/end_audio_pass_thru_request.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
EndAudioPassThruRequest::EndAudioPassThruRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-EndAudioPassThruRequest::~EndAudioPassThruRequest() {
-}
+EndAudioPassThruRequest::~EndAudioPassThruRequest() {}
void EndAudioPassThruRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -65,11 +62,9 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
bool result = mobile_apis::Result::SUCCESS == mobile_code;
if (result) {
- bool ended_successfully =
- ApplicationManagerImpl::instance()->end_audio_pass_thru();
+ bool ended_successfully = application_manager_.EndAudioPassThrough();
if (ended_successfully) {
- ApplicationManagerImpl::instance()->StopAudioPassThru(
- connection_key());
+ application_manager_.StopAudioPassThru(connection_key());
}
}
diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc
index 0ac1a00bd4..bb477f5083 100644
--- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/end_audio_pass_thru_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
EndAudioPassThruResponse::EndAudioPassThruResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-EndAudioPassThruResponse::~EndAudioPassThruResponse() {
-}
+EndAudioPassThruResponse::~EndAudioPassThruResponse() {}
void EndAudioPassThruResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/generic_response.cc b/src/components/application_manager/src/commands/mobile/generic_response.cc
index 69c841b2f1..20f6931bb9 100644
--- a/src/components/application_manager/src/commands/mobile/generic_response.cc
+++ b/src/components/application_manager/src/commands/mobile/generic_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/generic_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
@@ -55,7 +55,7 @@ void GenericResponse::Run() {
(*message_)[strings::params][strings::message_type] = MessageType::kResponse;
(*message_)[strings::msg_params][strings::success] = false;
(*message_)[strings::msg_params][strings::result_code] =
- mobile_apis::Result::INVALID_DATA;
+ mobile_apis::Result::INVALID_DATA;
SendResponse(false);
}
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
index f6791759a4..80bc89f853 100644
--- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/get_dtcs_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
@@ -40,17 +40,16 @@ namespace application_manager {
namespace commands {
-GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-GetDTCsRequest::~GetDTCsRequest() {
-}
+GetDTCsRequest::~GetDTCsRequest() {}
void GetDTCsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
@@ -59,8 +58,8 @@ void GetDTCsRequest::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);
msg_params[strings::ecu_name] =
(*message_)[strings::msg_params][strings::ecu_name];
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc
index 523711c975..ecaf5c3d8f 100644
--- a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc
+++ b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/get_dtcs_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-GetDTCsResponse::~GetDTCsResponse() {
-}
+GetDTCsResponse::~GetDTCsResponse() {}
void GetDTCsResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 719cae11b7..b4c6db9b91 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
@@ -33,7 +33,7 @@
#include <string>
#include "application_manager/commands/mobile/get_vehicle_data_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"
@@ -46,18 +46,18 @@ namespace commands {
namespace str = strings;
#ifdef HMI_DBUS_API
-GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+GetVehicleDataRequest::GetVehicleDataRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-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 = appplication_manager.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) {
-}
+GetVehicleDataRequest::GetVehicleDataRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-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 = application_manager_.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);
@@ -263,7 +275,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
&& 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)) {
@@ -283,8 +295,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/get_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc
index 5491e9b1aa..1e64746262 100644
--- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc
@@ -32,24 +32,23 @@
*/
#include "application_manager/commands/mobile/get_vehicle_data_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-GetVehicleDataResponse::GetVehicleDataResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+GetVehicleDataResponse::GetVehicleDataResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-GetVehicleDataResponse::~GetVehicleDataResponse() {
-}
+GetVehicleDataResponse::~GetVehicleDataResponse() {}
void GetVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
new file mode 100644
index 0000000000..9baf747ee4
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
@@ -0,0 +1,59 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/get_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+GetWayPointsRequest::GetWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
+
+GetWayPointsRequest::~GetWayPointsRequest() {}
+
+void GetWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "An application with connection key "
+ << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ msg_params = (*message_)[strings::msg_params];
+ msg_params[strings::app_id] = app->app_id();
+ SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints,
+ msg_params.empty() ? NULL : &msg_params,
+ true);
+}
+
+void GetWayPointsRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ const smart_objects::SmartObject& message = event.smart_object();
+ switch (event.id()) {
+ case hmi_apis::FunctionID::Navigation_GetWayPoints: {
+ LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints 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;
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ break;
+ }
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc
new file mode 100644
index 0000000000..7956b34cae
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc
@@ -0,0 +1,22 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/get_way_points_response.h"
+
+namespace application_manager {
+
+namespace commands {
+
+GetWayPointsResponse::GetWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
+
+GetWayPointsResponse::~GetWayPointsResponse() {}
+
+void GetWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ application_manager_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // 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..425f1ddb46 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,10 +31,11 @@
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"
-#include "config_profile/profile.h"
+
#include "application_manager/mobile_command_factory.h"
#include "utils/file_system.h"
@@ -42,18 +43,17 @@ namespace application_manager {
namespace commands {
-ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-ListFilesRequest::~ListFilesRequest() {
-}
+ListFilesRequest::~ListFilesRequest() {}
void ListFilesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!application) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -62,33 +62,43 @@ void ListFilesRequest::Run() {
}
if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
- (profile::Profile::instance()->list_files_in_none() <=
+ (application_manager_.get_settings().list_files_in_none() <=
application->list_files_in_none_count())) {
- // If application is in the HMI_NONE level the quantity of allowed
- // DeleteFile request is limited by the configuration profile
- LOG4CXX_ERROR(logger_, "Too many requests from the app with HMILevel HMI_NONE ");
- SendResponse(false, mobile_apis::Result::REJECTED);
- return;
+ // If application is in the HMI_NONE level the quantity of allowed
+ // DeleteFile request is limited by the configuration profile
+ LOG4CXX_ERROR(logger_,
+ "Too many requests from the app with HMILevel HMI_NONE ");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
}
application->increment_list_files_in_none_count();
(*message_)[strings::msg_params][strings::space_available] =
- static_cast<int32_t>(ApplicationManagerImpl::instance()->
- GetAvailableSpaceForApp(application->folder_name()));
- int32_t i = 0;
+ static_cast<int32_t>(application->GetAvailableDiskSpace());
+ 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);
+ it != app_files.end();
+ ++it) {
+ 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 < application_manager_.get_settings().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;
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL,
+ SendResponse(true,
+ mobile_apis::Result::SUCCESS,
+ NULL,
&(*message_)[strings::msg_params]);
}
diff --git a/src/components/application_manager/src/commands/mobile/list_files_response.cc b/src/components/application_manager/src/commands/mobile/list_files_response.cc
index 42bd1e6f07..fde15a94ef 100644
--- a/src/components/application_manager/src/commands/mobile/list_files_response.cc
+++ b/src/components/application_manager/src/commands/mobile/list_files_response.cc
@@ -32,24 +32,23 @@
*/
#include "application_manager/commands/mobile/list_files_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
-ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-ListFilesResponse::~ListFilesResponse() {
-}
+ListFilesResponse::~ListFilesResponse() {}
void ListFilesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc
index e3e51faa6e..6064374dab 100644
--- a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc
@@ -39,12 +39,11 @@ namespace application_manager {
namespace commands {
OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnAppInterfaceUnregisteredNotification::~OnAppInterfaceUnregisteredNotification() {
-}
+OnAppInterfaceUnregisteredNotification::
+ ~OnAppInterfaceUnregisteredNotification() {}
void OnAppInterfaceUnregisteredNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc
index d1329bf8ea..d0fa3597bc 100644
--- a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
OnAudioPassThruNotification::OnAudioPassThruNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnAudioPassThruNotification::~OnAudioPassThruNotification() {
-}
+OnAudioPassThruNotification::~OnAudioPassThruNotification() {}
void OnAudioPassThruNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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..64043d2a88 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_button_event_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -43,50 +43,51 @@ namespace commands {
namespace mobile {
OnButtonEventNotification::OnButtonEventNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnButtonEventNotification::~OnButtonEventNotification() {
-}
+OnButtonEventNotification::~OnButtonEventNotification() {}
void OnButtonEventNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const uint32_t btn_id =
- static_cast<uint32_t>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+ const uint32_t btn_id = static_cast<uint32_t>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ const bool is_app_id_exists =
+ (*message_)[strings::msg_params].keyExists(strings::app_id);
+ const ApplicationSharedPtr app = application_manager_.application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
- LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id.");
+ if (!is_app_id_exists) {
+ 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.");
+ if (false ==
+ (*message_)[strings::msg_params].keyExists(
+ hmi_response::custom_button_id)) {
+ LOG4CXX_ERROR(logger_,
+ "CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
return;
}
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
- if (false == app.valid()) {
- LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application doesn't exist.");
return;
}
uint32_t custom_btn_id = 0;
- custom_btn_id = (*message_)[strings::msg_params]
- [hmi_response::custom_button_id].asUInt();
+ custom_btn_id =
+ (*message_)[strings::msg_params][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;
}
@@ -95,48 +96,47 @@ void OnButtonEventNotification::Run() {
return;
}
- const std::vector<ApplicationSharedPtr>& subscribedApps =
- ApplicationManagerImpl::instance()->applications_by_button(btn_id);
+ const std::vector<ApplicationSharedPtr>& subscribed_apps =
+ application_manager_.applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin();
- for (; subscribedApps.end() != it; ++it) {
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ subscribed_apps.begin();
+ for (; subscribed_apps.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
+ // 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())) {
- continue;
+ // if "app_id" absent send notification only in HMI_FULL mode
+ if (is_app_id_exists || subscribed_app->IsFullscreen()) {
+ SendButtonEvent(subscribed_app);
}
-
- SendButtonEvent(subscribed_app);
}
}
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();
+ 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;
}
-
(*on_btn_event)[strings::params][strings::connection_key] = app->app_id();
(*on_btn_event)[strings::params][strings::function_id] =
@@ -148,7 +148,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][hmi_response::button_mode];
if ((*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
+ hmi_response::custom_button_id)) {
(*on_btn_event)[strings::msg_params][strings::custom_button_id] =
(*message_)[strings::msg_params][strings::custom_button_id];
}
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..fdf8b559bc 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_button_press_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -43,50 +43,51 @@ namespace commands {
namespace mobile {
OnButtonPressNotification::OnButtonPressNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnButtonPressNotification::~OnButtonPressNotification() {
-}
+OnButtonPressNotification::~OnButtonPressNotification() {}
void OnButtonPressNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const uint32_t btn_id =
- static_cast<uint32_t>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+ const uint32_t btn_id = static_cast<uint32_t>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ const bool is_app_id_exists =
+ (*message_)[strings::msg_params].keyExists(strings::app_id);
+ const ApplicationSharedPtr app = application_manager_.application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
- LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonPress without app_id.");
+ if (!is_app_id_exists) {
+ 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.");
+ if (false ==
+ (*message_)[strings::msg_params].keyExists(
+ hmi_response::custom_button_id)) {
+ LOG4CXX_ERROR(logger_,
+ "CUSTOM_BUTTON OnButtonPress without custom_button_id.");
return;
}
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
- if (false == app.valid()) {
- LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application doesn't exist.");
return;
}
uint32_t custom_btn_id = 0;
- custom_btn_id = (*message_)[strings::msg_params]
- [hmi_response::custom_button_id].asUInt();
+ custom_btn_id =
+ (*message_)[strings::msg_params][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;
}
@@ -95,48 +96,47 @@ void OnButtonPressNotification::Run() {
return;
}
- const std::vector<ApplicationSharedPtr>& subscribedApps =
- ApplicationManagerImpl::instance()->applications_by_button(btn_id);
+ const std::vector<ApplicationSharedPtr>& subscribed_apps =
+ application_manager_.applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin();
- for (; subscribedApps.end() != it; ++it) {
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ subscribed_apps.begin();
+ for (; subscribed_apps.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
+ // 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())) {
- continue;
+ // if "app_id" absent send notification only in HMI_FULL mode
+ if (is_app_id_exists || subscribed_app->IsFullscreen()) {
+ SendButtonPress(subscribed_app);
}
-
- SendButtonPress(subscribed_app);
}
}
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();
+ 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;
}
-
(*on_btn_press)[strings::params][strings::connection_key] = app->app_id();
(*on_btn_press)[strings::params][strings::function_id] =
@@ -148,7 +148,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][hmi_response::button_mode];
if ((*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
+ hmi_response::custom_button_id)) {
(*on_btn_press)[strings::msg_params][strings::custom_button_id] =
(*message_)[strings::msg_params][strings::custom_button_id];
}
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..ae8aeff771 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
@@ -32,37 +32,35 @@
*/
#include "application_manager/commands/mobile/on_command_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
-OnCommandNotification::OnCommandNotification(const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+OnCommandNotification::OnCommandNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnCommandNotification::~OnCommandNotification() {
-}
+OnCommandNotification::~OnCommandNotification() {}
void OnCommandNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*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;
}
- const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id]
- .asUInt();
+ const uint32_t cmd_id =
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt();
if (!app->FindCommand(cmd_id)) {
- LOG4CXX_ERROR_EXT(logger_,
- " No applications found for the command " << cmd_id);
+ LOG4CXX_ERROR(logger_, " No applications found for the command " << cmd_id);
return;
}
diff --git a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc
index e9145520f4..44ed2cf3b7 100644
--- a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_driver_distraction_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -43,12 +43,10 @@ namespace commands {
namespace mobile {
OnDriverDistractionNotification::OnDriverDistractionNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnDriverDistractionNotification::~OnDriverDistractionNotification() {
-}
+OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc
index 10f3eb1ab6..19b93f2cbf 100644
--- a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc
@@ -33,7 +33,7 @@
*/
#include "application_manager/commands/mobile/on_hash_change_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include <string>
@@ -45,12 +45,10 @@ namespace commands {
namespace mobile {
OnHashChangeNotification::OnHashChangeNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnHashChangeNotification::~OnHashChangeNotification() {
-}
+OnHashChangeNotification::~OnHashChangeNotification() {}
void OnHashChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -60,17 +58,17 @@ void OnHashChangeNotification::Run() {
int32_t app_id;
app_id = (*message_)[strings::params][strings::connection_key].asInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ ApplicationSharedPtr app = application_manager_.application(app_id);
if (app) {
(*message_)[strings::msg_params][strings::hash_id] = app->curHash();
SendNotification();
} else {
- LOG4CXX_WARN(logger_, "Application with app_id " << app_id << " does not exist");
+ LOG4CXX_WARN(logger_,
+ "Application with app_id " << app_id << " does not exist");
}
-
}
-} //namespace mobile
+} // namespace mobile
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
index e4a2d7c340..5225002652 100644
--- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_hmi_status_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
#include "application_manager/message.h"
#include "interfaces/MOBILE_API.h"
@@ -41,20 +41,17 @@ namespace application_manager {
namespace commands {
OnHMIStatusNotification::OnHMIStatusNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnHMIStatusNotification::~OnHMIStatusNotification() {
-}
+OnHMIStatusNotification::~OnHMIStatusNotification() {}
void OnHMIStatusNotification::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 = application_manager_.application(connection_key());
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist");
return;
@@ -67,18 +64,18 @@ void OnHMIStatusNotification::Run() {
(mobile_apis::HMILevel::HMI_NONE == hmi_level)) {
if (!(app->tts_properties_in_none())) {
app->set_tts_properties_in_none(true);
- LOG4CXX_INFO(logger_, "OnHMIStatusNotification::Send TTS GlobalProperties"
+ LOG4CXX_INFO(logger_,
+ "OnHMIStatusNotification::Send TTS GlobalProperties"
" with empty array to HMI");
- MessageHelper::SendTTSGlobalProperties(app, false);
+ MessageHelper::SendTTSGlobalProperties(app, false, application_manager_);
}
} else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) ||
- (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) {
+ (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) {
if (!(app->tts_properties_in_full())) {
app->set_tts_properties_in_full(true);
LOG4CXX_INFO(logger_,
"OnHMIStatusNotification AddAppToTTSGlobalPropertiesList");
- ApplicationManagerImpl::instance()->AddAppToTTSGlobalPropertiesList(
- app->app_id());
+ application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id());
}
}
SendNotification();
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..9b16bd3572 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
@@ -32,7 +32,6 @@
*/
#include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h"
-#include "application_manager/application_manager_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/message.h"
@@ -40,30 +39,27 @@ namespace application_manager {
namespace commands {
OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile(
- const MessageSharedPtr& message)
- : CommandNotificationFromMobileImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationFromMobileImpl(message, application_manager) {}
-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 = application_manager_.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,44 +68,46 @@ void OnHMIStatusNotificationFromMobile::Run() {
connection_handler::DeviceHandle handle = app->device();
bool is_apps_requested_before =
- application_manager::ApplicationManagerImpl::instance()->
- IsAppsQueriedFrom(handle);
+ application_manager_.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()) {
// In case this notification will be received from mobile side with
// foreground level for app on mobile, this should trigger remote
// apps list query for SDL 4.0 app
- MessageHelper::SendQueryApps(connection_key());
+ MessageHelper::SendQueryApps(connection_key(), application_manager_);
return;
}
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;
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
bool is_another_foreground_sdl4_app = false;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
- for (;accessor.end() != it; ++it) {
+ ApplicationSetConstIt 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_.MarkAppsGreyOut(handle,
+ !is_current_state_foreground);
+ application_manager_.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..851e9f3059 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_keyboard_input_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -43,36 +43,37 @@ namespace commands {
namespace mobile {
OnKeyBoardInputNotification::OnKeyBoardInputNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {
-}
+OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {}
void OnKeyBoardInputNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app_to_notify;
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
- for (; accessor.end() != it; ++it) {
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetIt it = accessor.GetData().begin();
+ for (; accessor.GetData().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_language_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc
index 43b1b5b921..76420b85b6 100644
--- a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
OnLanguageChangeNotification::OnLanguageChangeNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnLanguageChangeNotification::~OnLanguageChangeNotification() {
-}
+OnLanguageChangeNotification::~OnLanguageChangeNotification() {}
void OnLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
index 62ea1af1fc..a4167a802e 100644
--- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
@@ -40,12 +40,10 @@ namespace application_manager {
namespace commands {
OnPermissionsChangeNotification::OnPermissionsChangeNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {
-}
+OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {}
void OnPermissionsChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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 fbcbaede81..b57490806c 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
@@ -36,8 +36,8 @@
#include "application_manager/commands/mobile/on_system_request_notification.h"
#include "interfaces/MOBILE_API.h"
#include "utils/file_system.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace application_manager {
@@ -46,8 +46,8 @@ namespace commands {
namespace mobile {
OnSystemRequestNotification::OnSystemRequestNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
OnSystemRequestNotification::~OnSystemRequestNotification() {}
@@ -56,8 +56,7 @@ void OnSystemRequestNotification::Run() {
using namespace application_manager;
using namespace mobile_apis;
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app.valid()) {
LOG4CXX_ERROR(logger_,
@@ -68,9 +67,10 @@ void OnSystemRequestNotification::Run() {
RequestType::eType request_type = static_cast<RequestType::eType>(
(*message_)[strings::msg_params][strings::request_type].asInt());
-
- if (!policy::PolicyHandler::instance()->IsRequestTypeAllowed(
- app->mobile_app_id(), request_type)) {
+ const policy::PolicyHandlerInterface& policy_handler =
+ application_manager_.GetPolicyHandler();
+ if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(),
+ request_type)) {
LOG4CXX_WARN(logger_,
"Request type " << request_type
<< " is not allowed by policies");
@@ -104,8 +104,9 @@ void OnSystemRequestNotification::Run() {
#ifdef EXTENDED_POLICY
void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
LOG4CXX_AUTO_TRACE(logger_);
- const int timeout = policy::PolicyHandler::instance()->TimeoutExchange();
+ const int timeout = application_manager_.GetPolicyHandler().TimeoutExchange();
+ size_t content_length;
char size_str[24];
if (0 > sprintf(size_str, "%zu", static_cast<size_t>(message.size()))) {
@@ -116,27 +117,46 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
if (0 > sprintf(timeout_str, "%d", timeout)) {
memset(timeout_str, 0, sizeof(timeout_str));
}
+
std::string policy_table_string = std::string(message.begin(), message.end());
- ParsePTString(policy_table_string);
+
+ /* The Content-Length to be sent in the HTTP Request header should be
+ calculated before additional escape characters are added to the
+ policy table string. The mobile proxy will remove the escape
+ characters after receiving this request. */
+
+ content_length = ParsePTString(policy_table_string);
+
+ if (0 > sprintf(size_str, "%zu", content_length)) {
+ memset(size_str, 0, sizeof(size_str));
+ }
+
const std::string header =
- "{"
- " \"HTTPRequest\": {"
- "\"headers\": {"
- "\"ContentType\": \"application/json\","
- "\"ConnectTimeout\": " + std::string(timeout_str) + ","
- "\"DoOutput\": true,"
- "\"DoInput\": true,"
- "\"UseCaches\": false,"
- "\"RequestMethod\": \"POST\","
- "\"ReadTimeout\":" + std::string(timeout_str) + ","
- "\"InstanceFollowRedirects\": false,"
- "\"charset\": \"utf-8\","
- "\"Content_Length\": " + std::string(size_str) +
- "},"
- "\"body\": \"" + policy_table_string + "\""
+ "{"
+ " \"HTTPRequest\": {"
+ "\"headers\": {"
+ "\"ContentType\": \"application/json\","
+ "\"ConnectTimeout\": " +
+ std::string(timeout_str) +
+ ","
+ "\"DoOutput\": true,"
+ "\"DoInput\": true,"
+ "\"UseCaches\": false,"
+ "\"RequestMethod\": \"POST\","
+ "\"ReadTimeout\":" +
+ std::string(timeout_str) +
+ ","
+ "\"InstanceFollowRedirects\": false,"
+ "\"charset\": \"utf-8\","
+ "\"Content_-Length\": " +
+ std::string(size_str) +
+ "},"
+ "\"body\": \"" +
+ policy_table_string +
+ "\""
"}"
- "}";
+ "}";
message.clear();
message.assign(header.begin(), header.end());
@@ -145,23 +165,28 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
logger_, "Header added: " << std::string(message.begin(), message.end()));
}
-void OnSystemRequestNotification::ParsePTString(std::string& pt_string) const{
+size_t OnSystemRequestNotification::ParsePTString(
+ std::string& pt_string) const {
std::string result;
- size_t length = pt_string.length();
- result.reserve(length*2);
- for(size_t i=0;i<length;++i){
- if(pt_string[i]=='\"' || pt_string[i]=='\\'){
+ size_t length = pt_string.length();
+ size_t result_length = length;
+ result.reserve(length * 2);
+ for (size_t i = 0; i < length; ++i) {
+ if (pt_string[i] == '\"' || pt_string[i] == '\\') {
result += '\\';
- } else if(pt_string[i] == '\n') {
+ } else if (pt_string[i] == '\n') {
+ result_length--; // contentLength is adjusted when this character is not
+ // copied to result.
continue;
}
result += pt_string[i];
}
pt_string = result;
+ return result_length;
}
#endif
-} //namespace mobile
+} // namespace mobile
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc
index 99a5d665db..894469ac34 100644
--- a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_tbt_client_state_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -41,12 +41,10 @@ namespace application_manager {
namespace commands {
OnTBTClientStateNotification::OnTBTClientStateNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnTBTClientStateNotification::~OnTBTClientStateNotification() {
-}
+OnTBTClientStateNotification::~OnTBTClientStateNotification() {}
void OnTBTClientStateNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -55,7 +53,7 @@ void OnTBTClientStateNotification::Run() {
static_cast<int32_t>(application_manager::MessageType::kNotification);
const std::vector<ApplicationSharedPtr>& applications =
- ApplicationManagerImpl::instance()->applications_with_navi();
+ application_manager_.applications_with_navi();
std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin();
for (; applications.end() != it; ++it) {
diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc
index 8780ab1b6a..c769194c95 100644
--- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_touch_event_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
@@ -42,18 +42,16 @@ namespace commands {
namespace mobile {
OnTouchEventNotification::OnTouchEventNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnTouchEventNotification::~OnTouchEventNotification() {
-}
+OnTouchEventNotification::~OnTouchEventNotification() {}
void OnTouchEventNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
const std::vector<ApplicationSharedPtr>& applications =
- ApplicationManagerImpl::instance()->applications_with_navi();
+ application_manager_.applications_with_navi();
std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin();
for (; applications.end() != it; ++it) {
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..37abbab351 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/on_vehicle_data_notification.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"
@@ -42,19 +42,17 @@ namespace application_manager {
namespace commands {
OnVehicleDataNotification::OnVehicleDataNotification(
- const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
-OnVehicleDataNotification::~OnVehicleDataNotification() {
-}
+OnVehicleDataNotification::~OnVehicleDataNotification() {}
void OnVehicleDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<ApplicationSharedPtr> appNotification;
std::vector<ApplicationSharedPtr>::iterator appNotification_it =
- appNotification.begin();
+ appNotification.begin();
std::vector<smart_objects::SmartObject> appSO;
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
@@ -63,39 +61,47 @@ void OnVehicleDataNotification::Run() {
for (; vehicle_data.end() != it; ++it) {
if (true == (*message_)[strings::msg_params].keyExists(it->first)) {
const std::vector<ApplicationSharedPtr>& applications =
- ApplicationManagerImpl::instance()->IviInfoUpdated(it->second,
- (*message_)[strings::msg_params][it->first].asInt());
+ application_manager_.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);
+ appNotification_it =
+ find(appNotification.begin(), appNotification.end(), app);
if (appNotification_it == appNotification.end()) {
appNotification.push_back(app);
- smart_objects::SmartObject msg_param = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_param =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_param[it->first] = (*message_)[strings::msg_params][it->first];
appSO.push_back(msg_param);
} else {
- size_t idx = std::distance(appNotification.begin(), appNotification_it);
+ size_t idx =
+ std::distance(appNotification.begin(), appNotification_it);
appSO[idx][it->first] = (*message_)[strings::msg_params][it->first];
}
}
}
}
- LOG4CXX_DEBUG(logger_, "Number of Notifications to be send: " <<
- appNotification.size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Number of Notifications to be send: " << appNotification.size());
for (size_t idx = 0; idx < appNotification.size(); idx++) {
- LOG4CXX_INFO(
- logger_,
- "Send OnVehicleData PRNDL notification to " << appNotification[idx]->name()
- << " application id " << appNotification[idx]->app_id());
+ LOG4CXX_INFO(logger_,
+ "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();
+ appNotification[idx]->app_id();
(*message_)[strings::msg_params] = appSO[idx];
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc
new file mode 100644
index 0000000000..0b24228810
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc
@@ -0,0 +1,61 @@
+/*
+
+ 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/on_way_point_change_notification.h"
+#include "application_manager/application_manager.h"
+
+namespace application_manager {
+namespace commands {
+
+OnWayPointChangeNotification::OnWayPointChangeNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandNotificationImpl(message, application_manager) {}
+
+OnWayPointChangeNotification::~OnWayPointChangeNotification() {}
+
+void OnWayPointChangeNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::set<int32_t> subscribed_for_way_points =
+ application_manager_.GetAppsSubscribedForWayPoints();
+
+ for (std::set<int32_t>::const_iterator app_id =
+ subscribed_for_way_points.begin();
+ app_id != subscribed_for_way_points.end();
+ ++app_id) {
+ (*message_)[strings::params][strings::connection_key] = *app_id;
+ SendNotification();
+ }
+}
+} // namespace commands
+} // namespace application_manager
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..d595119d45 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
@@ -33,9 +33,10 @@
#include <cstring>
#include "application_manager/commands/mobile/perform_audio_pass_thru_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 {
@@ -44,25 +45,19 @@ namespace commands {
namespace str = strings;
PerformAudioPassThruRequest::PerformAudioPassThruRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- is_active_tts_speak_(false),
- result_tts_speak_(mobile_apis::Result::SUCCESS) {
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , is_active_tts_speak_(false)
+ , result_tts_speak_(mobile_apis::Result::SUCCESS) {
subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
}
-PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {
-}
+PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {}
void PerformAudioPassThruRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) {
- ApplicationManagerImpl::instance()->StopAudioPassThru(connection_key());
- }
-
FinishTTSSpeak();
-
CommandRequestImpl::onTimeOut();
}
@@ -75,8 +70,7 @@ bool PerformAudioPassThruRequest::Init() {
void PerformAudioPassThruRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
@@ -92,7 +86,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 +107,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,47 +131,52 @@ 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";
}
- SendResponse(result, mobile_code, return_info.c_str(),
+ SendResponse(result,
+ mobile_code,
+ return_info.empty() ? NULL : return_info.c_str(),
&(message[strings::msg_params]));
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
- result_tts_speak_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
+ 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_) {
SendRecordStartNotification();
StartMicrophoneRecording();
// update request timeout to get time for perform audio recording
- ApplicationManagerImpl::instance()->
- updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
}
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
- ApplicationManagerImpl::instance()->updateRequestTimeout(
+ application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
@@ -180,7 +188,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;
@@ -189,8 +198,8 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
if ((*message_)[str::msg_params].keyExists(str::initial_prompt) &&
(0 < (*message_)[str::msg_params][str::initial_prompt].length())) {
for (uint32_t i = 0;
- i < (*message_)[str::msg_params][str::initial_prompt].length();
- ++i) {
+ i < (*message_)[str::msg_params][str::initial_prompt].length();
+ ++i) {
msg_params[hmi_request::tts_chunks][i][str::text] =
(*message_)[str::msg_params][str::initial_prompt][i][str::text];
msg_params[hmi_request::tts_chunks][i][str::type] =
@@ -205,12 +214,13 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
}
void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
- 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[str::app_id] = connection_key();
- // duration
msg_params[hmi_request::max_duration] =
(*message_)[str::msg_params][str::max_duration];
@@ -218,21 +228,21 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
smart_objects::SmartObject(smart_objects::SmartType_Array);
if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text1)) {
- msg_params[hmi_request::audio_pass_display_texts]
- [0][hmi_request::field_name] = static_cast<int32_t>
- (hmi_apis::Common_TextFieldName::audioPassThruDisplayText1);
- msg_params[hmi_request::audio_pass_display_texts]
- [0][hmi_request::field_text] =
- (*message_)[str::msg_params][str::audio_pass_display_text1];
+ msg_params[hmi_request::audio_pass_display_texts][0]
+ [hmi_request::field_name] = static_cast<int32_t>(
+ hmi_apis::Common_TextFieldName::audioPassThruDisplayText1);
+ msg_params[hmi_request::audio_pass_display_texts][0]
+ [hmi_request::field_text] =
+ (*message_)[str::msg_params][str::audio_pass_display_text1];
}
if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text2)) {
- msg_params[hmi_request::audio_pass_display_texts]
- [1][hmi_request::field_name] = static_cast<int32_t>
- (hmi_apis::Common_TextFieldName::audioPassThruDisplayText2);
- msg_params[hmi_request::audio_pass_display_texts]
- [1][hmi_request::field_text] =
- (*message_)[str::msg_params][str::audio_pass_display_text2];
+ msg_params[hmi_request::audio_pass_display_texts][1]
+ [hmi_request::field_name] = static_cast<int32_t>(
+ hmi_apis::Common_TextFieldName::audioPassThruDisplayText2);
+ msg_params[hmi_request::audio_pass_display_texts][1]
+ [hmi_request::field_text] =
+ (*message_)[str::msg_params][str::audio_pass_display_text2];
}
if ((*message_)[str::msg_params].keyExists(str::mute_audio)) {
@@ -243,23 +253,28 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
msg_params[str::mute_audio] = true;
}
- SendHMIRequest(hmi_apis::FunctionID::UI_PerformAudioPassThru,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::UI_PerformAudioPassThru, &msg_params, true);
}
void PerformAudioPassThruRequest::SendRecordStartNotification() {
- 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[strings::app_id] = connection_key();
CreateHMINotification(hmi_apis::FunctionID::UI_OnRecordStart, msg_params);
}
void PerformAudioPassThruRequest::StartMicrophoneRecording() {
- ApplicationManagerImpl::instance()->begin_audio_pass_thru();
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ application_manager_.BeginAudioPassThrough();
- ApplicationManagerImpl::instance()->StartAudioPassThruThread(
- connection_key(), correlation_id(),
+ application_manager_.StartAudioPassThruThread(
+ connection_key(),
+ correlation_id(),
(*message_)[str::msg_params][str::max_duration].asInt(),
(*message_)[str::msg_params][str::sampling_rate].asInt(),
(*message_)[str::msg_params][str::bits_per_sample].asInt(),
@@ -286,25 +301,25 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params].
- keyExists(strings::audio_pass_display_text1)) {
-
- str = (*message_)[strings::msg_params]
- [strings::audio_pass_display_text1].asCharArray();
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::audio_pass_display_text1)) {
+ str = (*message_)[strings::msg_params][strings::audio_pass_display_text1]
+ .asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
+ LOG4CXX_ERROR(
+ logger_,
"Invalid audio_pass_display_text1 value syntax check failed");
return true;
}
}
- if ((*message_)[strings::msg_params].
- keyExists(strings::audio_pass_display_text2)) {
-
- str = (*message_)[strings::msg_params]
- [strings::audio_pass_display_text2].asCharArray();
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::audio_pass_display_text2)) {
+ str = (*message_)[strings::msg_params][strings::audio_pass_display_text2]
+ .asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
+ LOG4CXX_ERROR(
+ logger_,
"Invalid audio_pass_display_text2 value syntax check failed");
return true;
}
@@ -312,11 +327,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 (application_manager_.EndAudioPassThrough()) {
+ LOG4CXX_DEBUG(logger_, "Stop AudioPassThru.");
+ application_manager_.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 =
+ application_manager_.get_settings().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_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc
index 585383889d..e8a638c076 100644
--- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc
@@ -32,25 +32,21 @@
*/
#include "application_manager/commands/mobile/perform_audio_pass_thru_response.h"
-#include "application_manager/application_manager_impl.h"
-
namespace application_manager {
namespace commands {
PerformAudioPassThruResponse::PerformAudioPassThruResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {
-}
+PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {}
void PerformAudioPassThruResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // 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..39ad51e822 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
@@ -34,39 +34,44 @@
#include <string.h>
#include <string>
#include "application_manager/commands/mobile/perform_interaction_request.h"
-#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 "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/custom_string.h"
+#include "utils/gen_hash.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, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , 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)) {
@@ -87,8 +92,7 @@ bool PerformInteractionRequest::Init() {
void PerformInteractionRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -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,41 @@ 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]))) {
+ 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;
}
- smart_objects::SmartObject& choice_list =
- msg_params[strings::interaction_choice_set_id_list];
-
- 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, application_manager_)) {
+ LOG4CXX_ERROR(logger_,
+ "Verification of " << strings::vr_help << " failed.");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
@@ -169,27 +177,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 +215,35 @@ 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");
+ application_manager_.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 +251,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 +269,14 @@ void PerformInteractionRequest::onTimeOut() {
DisablePerformInteraction();
CommandRequestImpl::onTimeOut();
} else {
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
}
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
@@ -273,155 +292,160 @@ 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());
+ ApplicationSharedPtr app = application_manager_.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");
+ application_manager_.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()) {
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- bool result = false;
- std::string info;
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ ui_result_ = Compare<mobile_api::Result::eType, EQ, ONE>(
+ ui_resultCode_,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
+ const bool is_pi_warning = Compare<mobile_api::Result::eType, EQ, ONE>(
+ ui_resultCode_, mobile_apis::Result::WARNINGS);
- 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 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);
+ const SmartObject* response_params = msg_params.empty() ? NULL : &msg_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 +467,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 +492,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 +507,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 +540,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 +559,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()) {
@@ -550,8 +569,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
// Since there is no custom data from application side, SDL should
// construct prompt and append delimiter to each item
item[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
- item[strings::text] = vr_commands[0].asString() +
- profile::Profile::instance()->tts_delimiter();
+ item[strings::text] =
+ vr_commands[0].asString() +
+ application_manager_.get_settings().tts_delimiter();
msg_params[strings::help_prompt][index++] = item;
}
}
@@ -563,7 +583,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 +591,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 +641,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 +665,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 +703,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;
}
@@ -692,16 +720,15 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
}
}
}
-
return true;
}
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 +739,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,8 +750,9 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions(
}
void PerformInteractionRequest::DisablePerformInteraction() {
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -750,7 +779,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 +855,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 +877,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 +890,101 @@ 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/perform_interaction_response.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc
index 59d706926d..6003751669 100644
--- a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/perform_interaction_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
PerformInteractionResponse::PerformInteractionResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-PerformInteractionResponse::~PerformInteractionResponse() {
-}
+PerformInteractionResponse::~PerformInteractionResponse() {}
void PerformInteractionResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..68e7ad60d1 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
@@ -31,36 +31,36 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
#include "application_manager/commands/mobile/put_file_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/policies/policy_handler.h"
#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
+
#include "utils/file_system.h"
namespace application_manager {
namespace commands {
-PutFileRequest::PutFileRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message)
- , offset_(0)
- , sync_file_name_()
- , length_(0)
- , file_type_(mobile_apis::FileType::INVALID_ENUM)
- , is_persistent_file_(false) {
-}
+PutFileRequest::PutFileRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , offset_(0)
+ , sync_file_name_()
+ , length_(0)
+ , file_type_(mobile_apis::FileType::INVALID_ENUM)
+ , is_persistent_file_(false) {}
-PutFileRequest::~PutFileRequest() {
-}
+PutFileRequest::~PutFileRequest() {}
void PutFileRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
- smart_objects::SmartObject response_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ application_manager_.application(connection_key());
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!application) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -69,13 +69,14 @@ void PutFileRequest::Run() {
}
if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() &&
- profile::Profile::instance()->put_file_in_none() <=
- application->put_file_in_none_count()) {
+ application_manager_.get_settings().put_file_in_none() <=
+ application->put_file_in_none_count()) {
// If application is in the HMI_NONE level the quantity of allowed
// PutFile request is limited by the configuration profile
LOG4CXX_ERROR(logger_,
"Too many requests from the app with HMILevel HMI_NONE ");
- SendResponse(false, mobile_apis::Result::REJECTED,
+ SendResponse(false,
+ mobile_apis::Result::REJECTED,
"Too many requests from the app with HMILevel HMI_NONE",
&response_params);
return;
@@ -83,7 +84,8 @@ void PutFileRequest::Run() {
if (!(*message_)[strings::params].keyExists(strings::binary_data)) {
LOG4CXX_ERROR(logger_, "Binary data empty");
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
"Binary data empty",
&response_params);
return;
@@ -91,7 +93,8 @@ void PutFileRequest::Run() {
if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) {
LOG4CXX_ERROR(logger_, "No file name");
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
"No file name",
&response_params);
return;
@@ -99,23 +102,24 @@ void PutFileRequest::Run() {
if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) {
LOG4CXX_ERROR(logger_, "No file type");
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
"No file type",
&response_params);
return;
}
sync_file_name_ =
- (*message_)[strings::msg_params][strings::sync_file_name].asString();
- file_type_ =
- static_cast<mobile_apis::FileType::eType>(
+ (*message_)[strings::msg_params][strings::sync_file_name].asString();
+ file_type_ = static_cast<mobile_apis::FileType::eType>(
(*message_)[strings::msg_params][strings::file_type].asInt());
const std::vector<uint8_t> binary_data =
- (*message_)[strings::params][strings::binary_data].asBinary();
+ (*message_)[strings::params][strings::binary_data].asBinary();
// Policy table update in json format is currently to be received via PutFile
// TODO(PV): after latest discussion has to be changed
if (mobile_apis::FileType::JSON == file_type_) {
- policy::PolicyHandler::instance()->ReceiveMessageFromSDK(sync_file_name_, binary_data);
+ application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(
+ sync_file_name_, binary_data);
}
offset_ = 0;
@@ -127,83 +131,92 @@ 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].
- keyExists(strings::persistent_file)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::persistent_file)) {
is_persistent_file_ =
- (*message_)[strings::msg_params][strings::persistent_file].asBool();
+ (*message_)[strings::msg_params][strings::persistent_file].asBool();
}
- if ((*message_)[strings::msg_params].
- keyExists(strings::system_file)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::system_file)) {
is_system_file =
- (*message_)[strings::msg_params][strings::system_file].asBool();
+ (*message_)[strings::msg_params][strings::system_file].asBool();
}
std::string file_path;
if (is_system_file) {
response_params[strings::space_available] = 0;
- file_path = profile::Profile::instance()->system_files_path();
+ file_path = application_manager_.get_settings().system_files_path();
} else {
- file_path = profile::Profile::instance()->app_storage_folder();
+ file_path = application_manager_.get_settings().app_storage_folder();
file_path += "/" + application->folder_name();
- uint32_t space_available = ApplicationManagerImpl::instance()->
- GetAvailableSpaceForApp(application->folder_name());
+ uint32_t space_available = application->GetAvailableDiskSpace();
if (binary_data.size() > space_available) {
-
response_params[strings::space_available] =
static_cast<uint32_t>(space_available);
LOG4CXX_ERROR(logger_, "Out of memory");
- SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY,
- "Out of memory", &response_params);
+ SendResponse(false,
+ mobile_apis::Result::OUT_OF_MEMORY,
+ "Out of memory",
+ &response_params);
return;
}
}
if (!file_system::CreateDirectoryRecursively(file_path)) {
- LOG4CXX_ERROR(logger_, "Cann't create folder");
- SendResponse(false, mobile_apis::Result::GENERIC_ERROR,
- "Cann't create folder.", &response_params);
+ LOG4CXX_ERROR(logger_, "Can't create folder");
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Can't create folder.",
+ &response_params);
return;
}
-
- mobile_apis::Result::eType save_result =
- ApplicationManagerImpl::instance()->SaveBinary(binary_data, file_path,
- sync_file_name_, offset_);
-
+ const std::string full_path = file_path + "/" + sync_file_name_;
+ UNUSED(full_path);
+ LOG4CXX_DEBUG(logger_,
+ "Wrtiting " << binary_data.size() << "bytes to " << full_path
+ << " (current size is"
+ << file_system::FileSize(full_path) << ")");
+
+ mobile_apis::Result::eType save_result = application_manager_.SaveBinary(
+ binary_data, file_path, sync_file_name_, offset_);
+
+ LOG4CXX_DEBUG(logger_,
+ "New size of " << full_path << " is "
+ << file_system::FileSize(full_path) << " bytes");
if (!is_system_file) {
- response_params[strings::space_available] = static_cast<uint32_t>(
- ApplicationManagerImpl::instance()->GetAvailableSpaceForApp(
- application->folder_name()));
+ response_params[strings::space_available] =
+ static_cast<uint32_t>(application->GetAvailableDiskSpace());
}
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_);
+ AppFile file(sync_file_name_,
+ is_persistent_file_,
+ is_download_compleate,
+ file_type_);
if (0 == offset_) {
LOG4CXX_INFO(logger_, "New file downloading");
if (!application->AddFile(file)) {
-
LOG4CXX_INFO(logger_,
"Couldn't add file to application (File already Exist"
- << " in application and was rewritten on FS)");
+ << " in application and was rewritten on FS)");
/* 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,
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
"Couldn't update file",
&response_params);
return;
@@ -224,20 +237,21 @@ 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;
}
}
void PutFileRequest::SendOnPutFileNotification() {
- LOG4CXX_INFO(logger_, "SendOnPutFileNotification" );
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ LOG4CXX_INFO(logger_, "SendOnPutFileNotification");
+ smart_objects::SmartObjectSPtr notification =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnPutFile;
+ hmi_apis::FunctionID::BasicCommunication_OnPutFile;
message[strings::params][strings::message_type] = MessageType::kNotification;
message[strings::msg_params][strings::app_id] = connection_key();
@@ -250,7 +264,7 @@ void PutFileRequest::SendOnPutFileNotification() {
message[strings::msg_params][strings::length] = length_;
message[strings::msg_params][strings::persistent_file] = is_persistent_file_;
message[strings::msg_params][strings::file_type] = file_type_;
- ApplicationManagerImpl::instance()->ManageHMICommand(notification);
+ application_manager_.ManageHMICommand(notification);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/put_file_response.cc b/src/components/application_manager/src/commands/mobile/put_file_response.cc
index 52598fda16..50c62aef7f 100644
--- a/src/components/application_manager/src/commands/mobile/put_file_response.cc
+++ b/src/components/application_manager/src/commands/mobile/put_file_response.cc
@@ -34,31 +34,28 @@
#include "application_manager/commands/mobile/put_file_response.h"
#include "utils/file_system.h"
#include "application_manager/application_impl.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-PutFileResponse::PutFileResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+PutFileResponse::PutFileResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-PutFileResponse::~PutFileResponse() {
-}
+PutFileResponse::~PutFileResponse() {}
void PutFileResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = (*message_)[strings::params][strings::connection_key]
- .asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ uint32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "Application not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
-
SendResponse((*message_)[strings::msg_params][strings::success].asBool());
}
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..69885f9d40 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,8 +30,9 @@
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"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -41,45 +41,46 @@ namespace application_manager {
namespace commands {
-ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-ReadDIDRequest::~ReadDIDRequest() {
-}
+ReadDIDRequest::~ReadDIDRequest() {}
void ReadDIDRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = (*message_)[strings::params][strings::connection_key]
- .asUInt();
+ uint32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
- LOG4CXX_INFO(logger_, "Correlation_id :" << (*message_)[strings::params][strings::correlation_id]
- .asUInt());
+ ApplicationSharedPtr app = application_manager_.application(app_id);
+ LOG4CXX_INFO(
+ logger_,
+ "Correlation_id :"
+ << (*message_)[strings::params][strings::correlation_id].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;
}
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_, "ReadDID frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
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;
}
- 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::ecu_name] =
(*message_)[strings::msg_params][strings::ecu_name];
@@ -101,7 +102,13 @@ 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/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc
index 1133fe89ed..e54c4ba005 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_response.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/read_did_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-ReadDIDResponse::~ReadDIDResponse() {
-}
+ReadDIDResponse::~ReadDIDResponse() {}
void ReadDIDResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 6a724bfacf..e9f6db05b2 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
@@ -35,18 +35,22 @@
#include <unistd.h>
#include <algorithm>
+#include <map>
#include <string.h>
-#include "application_manager/application_manager_impl.h"
+#include <utils/make_shared.h>
+#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/policies/policy_handler.h"
-#include "config_profile/profile.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "interfaces/MOBILE_API.h"
+#include "interfaces/generated_msg_version.h"
namespace {
+namespace custom_str = utils::custom_string;
-mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string &str) {
+mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) {
if ("DEFAULT" == str) {
return mobile_apis::AppHMIType::DEFAULT;
} else if ("COMMUNICATION" == str) {
@@ -72,33 +76,55 @@ mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string &str) {
}
}
+std::string AppHMITypeToString(mobile_apis::AppHMIType::eType type) {
+ const std::map<mobile_apis::AppHMIType::eType, std::string> app_hmi_type_map =
+ {{mobile_apis::AppHMIType::DEFAULT, "DEFAULT"},
+ {mobile_apis::AppHMIType::COMMUNICATION, "COMMUNICATION"},
+ {mobile_apis::AppHMIType::MEDIA, "MEDIA"},
+ {mobile_apis::AppHMIType::MESSAGING, "MESSAGING"},
+ {mobile_apis::AppHMIType::NAVIGATION, "NAVIGATION"},
+ {mobile_apis::AppHMIType::INFORMATION, "INFORMATION"},
+ {mobile_apis::AppHMIType::SOCIAL, "SOCIAL"},
+ {mobile_apis::AppHMIType::BACKGROUND_PROCESS, "BACKGROUND_PROCESS"},
+ {mobile_apis::AppHMIType::TESTING, "TESTING"},
+ {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}};
+
+ std::map<mobile_apis::AppHMIType::eType, std::string>::const_iterator iter =
+ app_hmi_type_map.find(type);
+
+ return app_hmi_type_map.end() != iter ? iter->second : std::string("");
+}
+
struct AppHMITypeInserter {
- AppHMITypeInserter(smart_objects::SmartObject &so_array)
+ AppHMITypeInserter(smart_objects::SmartObject& so_array)
: index_(0), so_array_(so_array) {}
- bool operator()(const std::string &app_hmi_type) {
+ bool operator()(const std::string& app_hmi_type) {
so_array_[index_] = StringToAppHMIType(app_hmi_type);
++index_;
return true;
}
-private:
+ private:
uint32_t index_;
- smart_objects::SmartObject &so_array_;
+ smart_objects::SmartObject& so_array_;
};
struct CheckMissedTypes {
- CheckMissedTypes(const policy::StringArray &policy_app_types,
- std::string &log)
+ 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;
+ bool operator()(const smart_objects::SmartArray::value_type& value) {
+ std::string app_type_str = AppHMITypeToString(
+ static_cast<mobile_apis::AppHMIType::eType>(value.asInt()));
+ if (!app_type_str.empty()) {
+ 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;
+ }
}
}
@@ -108,19 +134,19 @@ struct CheckMissedTypes {
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_;
};
}
@@ -129,9 +155,9 @@ 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, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
@@ -141,8 +167,9 @@ 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
@@ -151,24 +178,21 @@ void RegisterAppInterfaceRequest::Run() {
// FIXME(EZamakhov): on shutdown - get freez
// wait till HMI started
- 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(
+ while (!application_manager_.IsStopping() &&
+ !application_manager_.IsHMICooperating()) {
+ LOG4CXX_DEBUG(logger_,
+ "Waiting for the HMI... conn_key="
+ << connection_key()
+ << ", correlation_id=" << correlation_id()
+ << ", default_timeout=" << default_timeout()
+ << ", thread=" << pthread_self());
+ application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
sleep(1);
// TODO(DK): timer_->StartWait(1);
}
- if (!ApplicationManagerImpl::exists()) {
- LOG4CXX_WARN(logger_, "The ApplicationManager doesn't exist!");
- return;
- } else if (ApplicationManagerImpl::instance()->IsStopping()) {
+ if (application_manager_.IsStopping()) {
LOG4CXX_WARN(logger_, "The ApplicationManager is stopping!");
return;
}
@@ -177,21 +201,35 @@ void RegisterAppInterfaceRequest::Run() {
(*message_)[strings::msg_params][strings::app_id].asString();
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.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 (application_manager_.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;
}
@@ -199,11 +237,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);
+ GetPolicyHandler().GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_DUPLICATE_NAME);
++count_of_rejections_duplicate_name;
}
SendResponse(false, coincidence_result);
@@ -217,129 +256,173 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- const smart_objects::SmartObject &msg_params =
- (*message_)[strings::msg_params];
-
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->RegisterApplication(message_);
+ application = application_manager_.RegisterApplication(message_);
- if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "Application "
- << msg_params[strings::app_name].asString()
- << " hasn't been registered!");
+ 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 = application_manager_.resume_controller();
+ const std::string& device_mac = application->mac_address();
+
+ // there is side affect with 2 mobile app with the same mobile app_id
+ if (resumer.IsApplicationSaved(policy_app_id, device_mac)) {
+ application->set_hmi_application_id(
+ resumer.GetHMIApplicationID(policy_app_id, device_mac));
} else {
- app->set_is_media_application(
- msg_params[strings::is_media_application].asBool());
+ application->set_hmi_application_id(
+ application_manager_.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::app_hmi_type)) {
- app->set_app_types(msg_params[strings::app_hmi_type]);
+ if (msg_params.keyExists(strings::tts_name)) {
+ application->set_tts_name(msg_params[strings::tts_name]);
+ }
- // check app type
- const smart_objects::SmartObject &app_type =
- msg_params.getElement(strings::app_hmi_type);
+ if (msg_params.keyExists(strings::app_hmi_type)) {
+ application->set_app_types(msg_params[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>(
- app_type.getElement(i).asUInt())) {
- app->set_voice_communication_supported(true);
- }
+ // 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())) {
+ 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 ==
+ application_manager_.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::DeviceInfo device_info;
+ device_info.AdoptDeviceType(dev_params.device_connection_type);
+ if (msg_params.keyExists(strings::device_info)) {
+ FillDeviceInfo(&device_info);
+ }
- policy::PolicyHandler::instance()->SetDeviceInfo(device_mac_address,
- device_info);
+ GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
- SendRegisterAppInterfaceResponseToMobile();
+ SendRegisterAppInterfaceResponseToMobile();
+ smart_objects::SmartObjectSPtr so =
+ GetLockScreenIconUrlNotification(connection_key(), application);
+ application_manager_.ManageMobileCommand(so, commands::Command::ORIGIN_SDL);
+}
- MessageHelper::SendLockScreenIconUrlNotification(
- (*message_)[strings::params][strings::connection_key].asInt());
- }
+smart_objects::SmartObjectSPtr
+RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
+ const uint32_t connection_key, ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr());
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<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::msg_params][strings::url] =
+ GetPolicyHandler().GetLockScreenIconUrl();
+ return message;
}
-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 =
+ application_manager_.hmi_capabilities();
+
const uint32_t key = connection_key();
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(key);
+ ApplicationSharedPtr application = application_manager_.application(key);
+
+ resumption::ResumeCtrl& resumer = application_manager_.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;
+ major_version; // From generated file interfaces/generated_msg_version.h
response_params[strings::sync_msg_version][strings::minor_version] =
- APIVersion::kAPIV0;
+ minor_version; // From generated file interfaces/generated_msg_version.h
response_params[strings::language] = hmi_capabilities.active_vr_language();
response_params[strings::hmi_display_language] =
hmi_capabilities.active_ui_language();
- const smart_objects::SmartObject &msg_params =
+ const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
if (msg_params[strings::language_desired].asInt() !=
hmi_capabilities.active_vr_language() ||
msg_params[strings::hmi_display_language_desired].asInt() !=
hmi_capabilities.active_ui_language()) {
+ LOG4CXX_WARN(logger_,
+ "Wrong language on registering application "
+ << application->name().c_str());
- LOG4CXX_WARN_EXT(logger_, "Wrong language on registering application "
- << application->name());
-
- LOG4CXX_ERROR_EXT(
+ LOG4CXX_ERROR(
logger_,
- "vr " << msg_params[strings::language_desired].asInt() << " - "
- << hmi_capabilities.active_vr_language() << "ui "
- << msg_params[strings::hmi_display_language_desired].asInt()
- << " - " << hmi_capabilities.active_ui_language());
-
- result = mobile_apis::Result::WRONG_LANGUAGE;
+ "VR language desired code is "
+ << msg_params[strings::language_desired].asInt()
+ << " , active VR language code is "
+ << hmi_capabilities.active_vr_language() << ", UI language code is "
+ << msg_params[strings::hmi_display_language_desired].asInt()
+ << " , active UI language code is "
+ << hmi_capabilities.active_ui_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 &display_caps =
+ smart_objects::SmartObject& display_caps =
response_params[hmi_response::display_capabilities];
display_caps[hmi_response::display_type] =
@@ -433,6 +516,10 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
*hmi_capabilities.audio_pass_thru_capabilities();
}
}
+ if (hmi_capabilities.pcm_stream_capabilities()) {
+ response_params[strings::pcm_stream_capabilities] =
+ *hmi_capabilities.pcm_stream_capabilities();
+ }
if (hmi_capabilities.vehicle_type()) {
response_params[hmi_response::vehicle_type] =
*hmi_capabilities.vehicle_type();
@@ -442,8 +529,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
*(hmi_capabilities.prerecorded_speech());
}
- const std::vector<uint32_t> &diag_modes =
- profile::Profile::instance()->supported_diag_modes();
+ const std::vector<uint32_t>& diag_modes =
+ application_manager_.get_settings().supported_diag_modes();
if (!diag_modes.empty()) {
std::vector<uint32_t>::const_iterator it = diag_modes.begin();
uint32_t index = 0;
@@ -460,82 +547,204 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
response_params[strings::hmi_capabilities][strings::phone_call] =
hmi_capabilities.phone_call_supported();
response_params[strings::sdl_version] =
- profile::Profile::instance()->sdl_version();
- response_params[strings::system_software_version] =
- hmi_capabilities.ccpu_version();
-
- ResumeCtrl &resumer = ApplicationManagerImpl::instance()->resume_controller();
- std::string hash_id = "";
+ application_manager_.get_settings().sdl_version();
+ const std::string ccpu_version =
+ application_manager_.hmi_capabilities().ccpu_version();
+ if (!ccpu_version.empty()) {
+ response_params[strings::system_software_version] = ccpu_version;
+ }
- 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
if (false == resumption) {
- resumption = resumer.IsApplicationSaved(application->mobile_app_id());
+ resumption = resumer.IsApplicationSaved(application->policy_app_id(),
+ application->mac_address());
}
- MessageHelper::SendOnAppRegisteredNotificationToHMI(
+ SendOnAppRegisteredNotificationToHMI(
*(application.get()), resumption, need_restore_vr);
+ SendResponse(true, result_code, add_info.c_str(), &response_params);
- SendResponse(true, result, add_info.c_str(), &response_params);
+ // Check if application exists, because application might be unregestered
+ // during sending reponse to mobile.
+ application = application_manager_.application(key);
+ if (application) {
+ LOG4CXX_DEBUG(logger_, "Application with app_id = " << key << " exists.");
+ if (result_code != mobile_apis::Result::RESUME_FAILED) {
+ resumer.StartResumption(application, hash_id);
+ } else {
+ resumer.StartResumptionOnlyHMILevel(application);
+ }
- if (result != mobile_apis::Result::RESUME_FAILED) {
- resumer.StartResumption(application, hash_id);
+ // By default app subscribed to CUSTOM_BUTTON
+ SendSubscribeCustomButtonNotification();
+ MessageHelper::SendChangeRegistrationRequestToHMI(application,
+ application_manager_);
} else {
- resumer.StartResumptionOnlyHMILevel(application);
+ LOG4CXX_DEBUG(logger_,
+ "Application with app_id = " << key << " doesn't exist.");
+ }
+}
+
+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;
+ GetPolicyHandler().GetPriority(application_impl.policy_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.policy_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 =
+ GetPolicyHandler().GetAppRequestTypes(application_impl.policy_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_.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);
}
- // By default app subscribed to CUSTOM_BUTTON
- // Need to send notification to HMI
- SendSubscribeCustomButtonNotification();
- MessageHelper::SendChangeRegistrationRequestToHMI(application);
+ device_info[strings::name] = device_name;
+ device_info[strings::id] = mac_address;
+
+ const policy::DeviceConsent device_consent =
+ GetPolicyHandler().GetUserConsentForDevice(mac_address);
+ device_info[strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+
+ device_info[strings::transport_type] =
+ application_manager_.GetDeviceTransportType(transport_type);
+
+ DCHECK(application_manager_.ManageHMICommand(notification));
}
mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject &msg_params =
+ const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationManagerImpl::ApplicationListAccessor accessor;
+ ApplicationSet accessor = application_manager_.applications().GetData();
- 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();
- if (!strcasecmp(app_name.c_str(), cur_name.c_str())) {
+ const custom_str::CustomString& cur_name = (*it)->name();
+ if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
- const smart_objects::SmartObject *vr = (*it)->vr_synonyms();
- const std::vector<smart_objects::SmartObject> *curr_vr = NULL;
+ const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
+ const std::vector<smart_objects::SmartObject>* curr_vr = NULL;
if (NULL != vr) {
curr_vr = vr->asArray();
CoincidencePredicateVR v(app_name);
@@ -548,7 +757,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
// vr check
if (msg_params.keyExists(strings::vr_synonyms)) {
- const std::vector<smart_objects::SmartObject> *new_vr =
+ const std::vector<smart_objects::SmartObject>* new_vr =
msg_params[strings::vr_synonyms].asArray();
CoincidencePredicateVR v(cur_name);
@@ -556,29 +765,29 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
- } // end vr check
+ } // end vr check
- } // application for end
+ } // application for end
return mobile_apis::Result::SUCCESS;
-} // method end
+} // 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
- if (!policy::PolicyHandler::instance()->PolicyEnabled()) {
+ if (!GetPolicyHandler().PolicyEnabled()) {
return mobile_apis::Result::WARNINGS;
}
- smart_objects::SmartObject &message = *message_;
+ smart_objects::SmartObject& message = *message_;
policy::StringArray app_nicknames;
policy::StringArray app_hmi_types;
- std::string mobile_app_id =
+ const std::string mobile_app_id =
message[strings::msg_params][strings::app_id].asString();
- const bool init_result = policy::PolicyHandler::instance()->GetInitialAppData(
+ const bool init_result = GetPolicyHandler().GetInitialAppData(
mobile_app_id, &app_nicknames, &app_hmi_types);
if (!init_result) {
@@ -588,7 +797,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
if (!app_nicknames.empty()) {
IsSameNickname compare(
- message[strings::msg_params][strings::app_name].asString());
+ 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) {
@@ -597,8 +806,9 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
// 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);
+ GetPolicyHandler().GetStatisticManager(),
+ mobile_app_id,
+ usage_statistics::REJECTIONS_NICKNAME_MISMATCH);
++count_of_rejections_nickname_mismatch;
return mobile_apis::Result::DISALLOWED;
}
@@ -618,9 +828,10 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
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;
}
}
@@ -628,7 +839,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
message[strings::msg_params][strings::app_hmi_type] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- smart_objects::SmartObject &app_hmi_type =
+ smart_objects::SmartObject& app_hmi_type =
message[strings::msg_params][strings::app_hmi_type];
AppHMITypeInserter inserter(app_hmi_type);
@@ -639,7 +850,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";
@@ -647,10 +858,10 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
const std::string carrier = "carrier";
const std::string max_number_rfcom_ports = "maxNumberRFCOMMPorts";
- const smart_objects::SmartObject &msg_params =
+ const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- const smart_objects::SmartObject &device_info_so =
+ const smart_objects::SmartObject& device_info_so =
msg_params[strings::device_info];
if (device_info_so.keyExists(hardware)) {
@@ -677,22 +888,19 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
}
bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
+ LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::"
- "IsApplicationWithSameAppIdRegistered");
+ const custom_string::CustomString mobile_app_id =
+ (*message_)[strings::msg_params][strings::app_id].asCustomString();
- const std::string mobile_app_id =
- (*message_)[strings::msg_params][strings::app_id].asString();
+ const ApplicationSet& applications =
+ application_manager_.applications().GetData();
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet 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)->policy_app_id().c_str())) {
return true;
}
}
@@ -702,7 +910,7 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
LOG4CXX_AUTO_TRACE(logger_);
- const char *str = NULL;
+ const char* str = NULL;
str = (*message_)[strings::msg_params][strings::app_name].asCharArray();
if (!CheckSyntax(str)) {
@@ -711,7 +919,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) {
- const smart_objects::SmartArray *tn_array =
+ const smart_objects::SmartArray* tn_array =
(*message_)[strings::msg_params][strings::tts_name].asArray();
smart_objects::SmartArray::const_iterator it_tn = tn_array->begin();
@@ -738,7 +946,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::vr_synonyms)) {
- const smart_objects::SmartArray *vs_array =
+ const smart_objects::SmartArray* vs_array =
(*message_)[strings::msg_params][strings::vr_synonyms].asArray();
smart_objects::SmartArray::const_iterator it_vs = vs_array->begin();
@@ -762,7 +970,6 @@ 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]
@@ -825,12 +1032,14 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
return true;
}
}
+
return false;
}
void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
- smart_objects::SmartObject &vehicle_type, const std::string &param,
- const std::string &backup_value) {
+ smart_objects::SmartObject& vehicle_type,
+ const std::string& param,
+ const std::string& backup_value) {
using namespace hmi_response;
if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) {
if (!backup_value.empty()) {
@@ -855,6 +1064,11 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
}
-} // namespace commands
+policy::PolicyHandlerInterface&
+RegisterAppInterfaceRequest::GetPolicyHandler() {
+ return application_manager_.GetPolicyHandler();
+}
+
+} // namespace commands
-} // namespace application_manager
+} // namespace application_manager
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 b910881273..1d7f829a68 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
@@ -33,9 +33,10 @@
#include "application_manager/commands/mobile/register_app_interface_response.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "connection_handler/connection_handler.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace application_manager {
@@ -44,7 +45,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
@@ -60,46 +61,48 @@ 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::ApplicationSharedPtr application =
- application_manager::ApplicationManagerImpl::instance()->application(
- connection_key());
-
+ application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application with connection key "
- << connection_key() << " is not registered.");
+ LOG4CXX_ERROR(logger_,
+ "Application with connection key " << connection_key()
+ << " is not registered.");
return;
}
- SetHeartBeatTimeout(connection_key(), application->mobile_app_id());
+ SetHeartBeatTimeout(connection_key(), application->policy_app_id());
// Default HMI level should be set before any permissions validation, since it
// relies on HMI level.
- ApplicationManagerImpl::instance()->OnApplicationRegistered(application);
+ application_manager_.OnApplicationRegistered(application);
// Sends OnPermissionChange notification to mobile right after RAI response
// and HMI level set-up
- policy::PolicyHandler::instance()->OnAppRegisteredOnMobile(
- application->mobile_app_id());
+ application_manager_.GetPolicyHandler().OnAppRegisteredOnMobile(
+ application->policy_app_id());
}
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
- uint32_t connection_key, const std::string &mobile_app_id) {
+ uint32_t connection_key, const std::string& mobile_app_id) {
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;
+ policy::PolicyHandlerInterface& policy_handler =
+ application_manager_.GetPolicyHandler();
+ if (policy_handler.PolicyEnabled()) {
+ const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id);
if (timeout > 0) {
- application_manager::ApplicationManagerImpl::instance()
- ->connection_handler()
- ->SetHeartBeatTimeout(connection_key, timeout);
+ application_manager_.connection_handler().SetHeartBeatTimeout(
+ connection_key, timeout);
}
} else {
LOG4CXX_INFO(logger_, "Policy is turn off");
}
}
-} // namespace commands
-} // namespace application_manager
+} // namespace commands
+} // namespace application_manager
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 2089d429ac..0260fef676 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
@@ -32,10 +32,10 @@
*/
#include "application_manager/commands/mobile/reset_global_properties_request.h"
-#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 "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -44,38 +44,36 @@ namespace application_manager {
namespace commands {
ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- is_ui_send_(false),
- is_tts_send_(false),
- is_ui_received_(false),
- is_tts_received_(false),
- ui_result_(hmi_apis::Common_Result::INVALID_ENUM),
- tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , is_ui_send_(false)
+ , is_tts_send_(false)
+ , is_ui_received_(false)
+ , is_tts_received_(false)
+ , ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
-ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {
-}
+ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {}
void ResetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ uint32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app = application_manager_.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;
}
- size_t obj_length = (*message_)[strings::msg_params][strings::properties]
- .length();
- //if application waits for sending ttsGlobalProperties need to remove this
- //application from tts_global_properties_app_list_
+ size_t obj_length =
+ (*message_)[strings::msg_params][strings::properties].length();
+ // 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);
+ application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id);
bool helpt_promt = false;
bool timeout_prompt = false;
@@ -96,20 +94,23 @@ void ResetGlobalPropertiesRequest::Run() {
} else if (mobile_apis::GlobalProperty::TIMEOUTPROMPT == global_property) {
timeout_prompt = ResetTimeoutPromt(app);
} else if (((mobile_apis::GlobalProperty::VRHELPTITLE == global_property) ||
- (mobile_apis::GlobalProperty::VRHELPITEMS == global_property)) &&
- (0 == number_of_reset_vr)) {
+ (mobile_apis::GlobalProperty::VRHELPITEMS ==
+ global_property)) &&
+ (0 == number_of_reset_vr)) {
++number_of_reset_vr;
vr_help_title_items = ResetVrHelpTitleItems(app);
} else if (mobile_apis::GlobalProperty::MENUNAME == global_property) {
menu_name = true;
} else if (mobile_apis::GlobalProperty::MENUICON == global_property) {
menu_icon = true;
- } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES == global_property) {
+ } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES ==
+ global_property) {
is_key_board_properties = true;
}
}
- if (vr_help_title_items || menu_name || menu_icon || is_key_board_properties) {
+ if (vr_help_title_items || menu_name || menu_icon ||
+ is_key_board_properties) {
is_ui_send_ = true;
}
@@ -119,13 +120,14 @@ void ResetGlobalPropertiesRequest::Run() {
app->set_reset_global_properties_active(true);
- if (vr_help_title_items || menu_name || menu_icon || is_key_board_properties) {
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ if (vr_help_title_items || menu_name || menu_icon ||
+ is_key_board_properties) {
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (vr_help_title_items) {
- smart_objects::SmartObjectSPtr vr_help = MessageHelper::CreateAppVrHelp(app);
+ smart_objects::SmartObjectSPtr vr_help =
+ MessageHelper::CreateAppVrHelp(app);
if (!vr_help) {
return;
}
@@ -135,19 +137,20 @@ void ResetGlobalPropertiesRequest::Run() {
msg_params[hmi_request::menu_title] = "";
app->set_menu_title(msg_params[hmi_request::menu_title]);
}
- //TODO(DT): clarify the sending parameter menuIcon
- //if (menu_icon) {
+ // TODO(DT): clarify the sending parameter menuIcon
+ // if (menu_icon) {
//}
if (is_key_board_properties) {
- smart_objects::SmartObject key_board_properties = smart_objects::
- SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] = static_cast<int32_t>
- (hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] = static_cast<int32_t>
- (hmi_apis::Common_KeyboardLayout::QWERTY);
+ smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ key_board_properties[strings::language] =
+ static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
+ key_board_properties[hmi_request::keyboard_layout] =
+ static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
// Look for APPLINK-4432 for details.
- /*smart_objects::SmartObject limited_character_list = smart_objects::SmartObject(
+ /*smart_objects::SmartObject limited_character_list =
+ smart_objects::SmartObject(
smart_objects::SmartType_Array);
limited_character_list[0] = "";
key_board_properties[hmi_request::limited_character_list] =
@@ -158,14 +161,14 @@ void ResetGlobalPropertiesRequest::Run() {
}
msg_params[strings::app_id] = app->app_id();
- SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::UI_SetGlobalProperties, &msg_params, true);
}
if (timeout_prompt || helpt_promt) {
// create ui request
- 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 (helpt_promt) {
msg_params[strings::help_prompt] = (*app->help_prompt());
@@ -177,20 +180,20 @@ void ResetGlobalPropertiesRequest::Run() {
msg_params[strings::app_id] = app->app_id();
- SendHMIRequest(hmi_apis::FunctionID::TTS_SetGlobalProperties,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties, &msg_params, true);
}
}
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;
}
- smart_objects::SmartObject so_help_prompt = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ smart_objects::SmartObject so_help_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
app->set_help_prompt(so_help_prompt);
return true;
}
@@ -198,20 +201,20 @@ 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;
}
- const std::vector<std::string>& time_out_promt = profile::Profile::instance()
- ->time_out_promt();
+ const std::vector<std::string>& time_out_promt =
+ application_manager_.get_settings().time_out_promt();
- smart_objects::SmartObject so_time_out_promt = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ smart_objects::SmartObject so_time_out_promt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
for (uint32_t i = 0; i < time_out_promt.size(); ++i) {
- smart_objects::SmartObject timeoutPrompt = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject timeoutPrompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
timeoutPrompt[strings::text] = time_out_promt[i];
timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
so_time_out_promt[i] = timeoutPrompt;
@@ -225,7 +228,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;
}
@@ -240,37 +243,38 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
switch (event.id()) {
- case hmi_apis::FunctionID::UI_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
- is_ui_received_ = true;
- ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- break;
- }
- case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
- is_tts_received_ = true;
- tts_result_ = 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;
- }
+ case hmi_apis::FunctionID::UI_SetGlobalProperties: {
+ LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
+ is_ui_received_ = true;
+ ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ break;
+ }
+ case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
+ LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
+ is_tts_received_ = true;
+ tts_result_ = 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;
+ }
}
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::INVALID_ENUM == tts_result_))
- || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_)
- && (hmi_apis::Common_Result::SUCCESS == tts_result_));
+ 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::INVALID_ENUM == tts_result_)) ||
+ ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) &&
+ (hmi_apis::Common_Result::SUCCESS == tts_result_));
mobile_apis::Result::eType result_code;
const char* return_info = NULL;
@@ -281,18 +285,20 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
return_info = "Unsupported phoneme type sent in a prompt";
} else {
result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
+ std::max(ui_result_, tts_result_));
}
} else {
result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
+ std::max(ui_result_, tts_result_));
}
- SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code),
- return_info, &(message[strings::msg_params]));
+ SendResponse(result,
+ static_cast<mobile_apis::Result::eType>(result_code),
+ return_info,
+ &(message[strings::msg_params]));
if (!application) {
- LOG4CXX_DEBUG(logger_, "NULL pointer");
+ LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
@@ -304,7 +310,6 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
}
}
-
bool ResetGlobalPropertiesRequest::IsPendingResponseExist() {
return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_;
}
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc
index 8e562956ae..c621977868 100644
--- a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc
+++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/reset_global_properties_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {
-}
+ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {}
void ResetGlobalPropertiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
index 10f080e0e7..89bd43fcd6 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
@@ -33,27 +33,27 @@
#include <string.h>
#include "application_manager/commands/mobile/scrollable_message_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
ScrollableMessageRequest::ScrollableMessageRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
}
-ScrollableMessageRequest::~ScrollableMessageRequest() {
-}
+ScrollableMessageRequest::~ScrollableMessageRequest() {}
bool ScrollableMessageRequest::Init() {
-
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
@@ -70,8 +70,7 @@ 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_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -79,10 +78,13 @@ void ScrollableMessageRequest::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);
+ MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params],
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!");
@@ -90,13 +92,12 @@ void ScrollableMessageRequest::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);
msg_params[hmi_request::message_text][hmi_request::field_name] =
- static_cast<int32_t>(hmi_apis::Common_TextFieldName::scrollableMessageBody);
+ static_cast<int32_t>(
+ hmi_apis::Common_TextFieldName::scrollableMessageBody);
msg_params[hmi_request::message_text][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::scroll_message_body];
msg_params[strings::app_id] = app->app_id();
@@ -114,36 +115,41 @@ 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()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_ScrollableMessage: {
LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event");
mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>
- (message[strings::params][hmi_response::code].asInt());
+ 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) &&
+ application_manager_.hmi_capabilities();
+
+ 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;
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
break;
}
}
@@ -151,4 +157,3 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc
index 212a3ba912..a5b16bdb70 100644
--- a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc
+++ b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/scrollable_message_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
@@ -41,22 +41,21 @@ namespace application_manager {
namespace commands {
ScrollableMessageResponse::ScrollableMessageResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
void ScrollableMessageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>(
- (*message_)[strings::msg_params][strings::result_code].asInt());
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asInt());
+ mobile_apis::Result::eType result_code =
+ static_cast<mobile_apis::Result::eType>(
+ (*message_)[strings::msg_params][strings::result_code].asInt());
+ ApplicationSharedPtr application = application_manager_.application(
+ (*message_)[strings::params][strings::connection_key].asInt());
if ((mobile_apis::Result::REJECTED != result_code) && application) {
application->UnsubscribeFromSoftButtons(
(*message_)[strings::params][strings::function_id].asInt());
}
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..975f7e43c3 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
@@ -30,39 +30,51 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+
#include "application_manager/commands/mobile/send_location_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
-SendLocationRequest::SendLocationRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+SendLocationRequest::SendLocationRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SendLocationRequest::~SendLocationRequest() {
-}
+SendLocationRequest::~SendLocationRequest() {}
void SendLocationRequest::Run() {
using namespace hmi_apis;
+ using smart_objects::SmartObject;
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
- ->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_,
- "An application with connection key " << connection_key()
- << " is not registered.");
+ LOG4CXX_ERROR(logger_,
+ "An application with connection key "
+ << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
- std::list<Common_TextFieldName::eType> fields_to_check;
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ if (msg_params.keyExists(strings::delivery_mode)) {
+ const std::vector<std::string>& allowed_params =
+ parameters_permissions().allowed_params;
+ if (allowed_params.end() == std::find(allowed_params.begin(),
+ allowed_params.end(),
+ strings::delivery_mode)) {
+ msg_params.erase(strings::delivery_mode);
+ }
+ }
+ std::vector<Common_TextFieldName::eType> fields_to_check;
if (msg_params.keyExists(strings::location_name)) {
fields_to_check.push_back(Common_TextFieldName::locationName);
}
@@ -87,11 +99,27 @@ void SendLocationRequest::Run() {
return;
}
- if ((*message_)[strings::msg_params].keyExists(strings::location_image)) {
+ if (msg_params.keyExists(strings::address)) {
+ const utils::custom_string::CustomString& address =
+ msg_params[strings::address].asCustomString();
+ if (address.empty()) {
+ msg_params.erase(strings::address);
+ }
+ }
+
+ if (!CheckFieldsCompatibility()) {
+ LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ if (msg_params.keyExists(strings::location_image)) {
mobile_apis::Result::eType verification_result =
mobile_apis::Result::SUCCESS;
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::location_image], app);
+ (*message_)[strings::msg_params][strings::location_image],
+ app,
+ application_manager_);
if (mobile_apis::Result::SUCCESS != verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
@@ -99,61 +127,76 @@ void SendLocationRequest::Run() {
}
}
- smart_objects::SmartObject request_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- request_msg_params = (*message_)[strings::msg_params];
+ SmartObject request_msg_params = SmartObject(smart_objects::SmartType_Map);
+ request_msg_params = msg_params;
request_msg_params[strings::app_id] = app->hmi_app_id();
-
- SendHMIRequest(hmi_apis::FunctionID::Navigation_SendLocation,
- &request_msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_SendLocation, &request_msg_params, true);
}
void SendLocationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SendLocationRquest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
+ namespace Result = mobile_apis::Result;
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
- switch (event.id()) {
- case hmi_apis::FunctionID::Navigation_SendLocation: {
- LOG4CXX_INFO(logger_, "Received Navigation_SendLocation 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 ||
- mobile_apis::Result::WARNINGS == result_code ||
- mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code ;
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
- break;
- }
+ if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) {
+ LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event");
+ mobile_apis::Result::eType result_code =
+ GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asUInt()));
+ const bool result =
+ Compare<Result::eType, EQ, ONE>(result_code,
+ Result::SAVED,
+ Result::SUCCESS,
+ Result::WARNINGS,
+ Result::UNSUPPORTED_RESOURCE);
+ SendResponse(result, result_code, NULL, &(message[strings::params]));
+ return;
}
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
}
-bool SendLocationRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "SendLocationRquest::IsWhiteSpaceExist");
- const char* str;
+bool SendLocationRequest::CheckFieldsCompatibility() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
-
- if (msg_params.keyExists(strings::location_name)) {
- str = msg_params[strings::location_name].asCharArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "parameter locationName contains invalid character");
- return true;
- }
+ MessageHelper::PrintSmartObject(msg_params);
+ const bool longitude_degrees_exist =
+ msg_params.keyExists(strings::longitude_degrees);
+ const bool latitude_degrees_exist =
+ msg_params.keyExists(strings::latitude_degrees);
+ const bool address_exist = msg_params.keyExists(strings::address);
+
+ if (latitude_degrees_exist ^ longitude_degrees_exist) {
+ LOG4CXX_DEBUG(logger_,
+ "latitude and longitude should be provided only in pair");
+ return false;
}
- if (msg_params.keyExists(strings::location_description)) {
- str = msg_params[strings::location_description].asCharArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "parameter locationDescription contains invalid character");
- return true;
- }
+ if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) {
+ LOG4CXX_DEBUG(logger_,
+ "address or latitude/longtitude should should be provided");
+ return false;
+ }
+ return true;
+}
+void insert_if_contains(
+ const smart_objects::SmartObject& msg_params,
+ const std::string& param_key,
+ std::vector<utils::custom_string::CustomString>& output_vector) {
+ if (msg_params.keyExists(param_key)) {
+ output_vector.push_back(msg_params[param_key].asCustomString());
}
+}
+
+bool SendLocationRequest::IsWhiteSpaceExist() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<utils::custom_string::CustomString> fields_to_check;
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+ insert_if_contains(msg_params, strings::location_name, fields_to_check);
+ insert_if_contains(
+ msg_params, strings::location_description, fields_to_check);
+ insert_if_contains(msg_params, strings::phone_number, fields_to_check);
if (msg_params.keyExists(strings::address_lines)) {
const smart_objects::SmartArray* al_array =
@@ -161,60 +204,63 @@ bool SendLocationRequest::IsWhiteSpaceExist() {
smart_objects::SmartArray::const_iterator it_al = al_array->begin();
smart_objects::SmartArray::const_iterator it_al_end = al_array->end();
for (; it_al != it_al_end; ++it_al) {
- str = (*it_al).asCharArray();
- if(!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "parameter address_lines contains invalid character");
- return true;
- }
+ const utils::custom_string::CustomString& val = (*it_al).asCustomString();
+ fields_to_check.push_back(val);
}
}
- if (msg_params.keyExists(strings::phone_number)) {
- str = msg_params[strings::phone_number].asCharArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "parameter phoneNumber contains invalid character");
- return true;
- }
+ if (msg_params.keyExists(strings::address)) {
+ const smart_objects::SmartObject& address_so = msg_params[strings::address];
+ insert_if_contains(address_so, strings::country_name, fields_to_check);
+ insert_if_contains(address_so, strings::country_code, fields_to_check);
+ insert_if_contains(address_so, strings::postal_code, fields_to_check);
+ insert_if_contains(
+ address_so, strings::administrative_area, fields_to_check);
+ insert_if_contains(address_so, strings::locality, fields_to_check);
+ insert_if_contains(address_so, strings::sub_locality, fields_to_check);
+ insert_if_contains(address_so, strings::thoroughfare, fields_to_check);
+ insert_if_contains(address_so, strings::sub_thoroughfare, fields_to_check);
}
- if (msg_params.keyExists(strings::location_image)) {
- str = msg_params[strings::location_image][strings::value].asCharArray();
- if (!CheckSyntax(str)) {
+ std::vector<utils::custom_string::CustomString>::iterator it =
+ fields_to_check.begin();
+ for (; it != fields_to_check.end(); ++it) {
+ const std::string& str = it->AsMBString();
+ if (!CheckSyntax(str, false)) {
LOG4CXX_ERROR(logger_,
- "parameter value in locationImage contains invalid character");
+ "string '" << str << "'' contains invalid characters");
return true;
}
}
-
return false;
}
-bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names) {
+bool SendLocationRequest::CheckHMICapabilities(
+ std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names) {
using namespace smart_objects;
using namespace hmi_apis;
-
if (fields_names.empty()) {
return true;
}
- ApplicationManagerImpl* instance = ApplicationManagerImpl::instance();
- const HMICapabilities& hmi_capabilities = instance->hmi_capabilities();
+ const HMICapabilities& hmi_capabilities =
+ application_manager_.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;
}
if (hmi_capabilities.display_capabilities()) {
const SmartObject disp_cap = (*hmi_capabilities.display_capabilities());
- const SmartObject& text_fields = disp_cap.getElement(hmi_response::text_fields);
+ const SmartObject& text_fields =
+ disp_cap.getElement(hmi_response::text_fields);
const size_t len = text_fields.length();
for (size_t i = 0; i < len; ++i) {
const SmartObject& text_field = text_fields[i];
const Common_TextFieldName::eType filed_name =
- static_cast<Common_TextFieldName::eType>(text_field.getElement(strings::name).asInt());
- const std::list<Common_TextFieldName::eType>::iterator it =
+ static_cast<Common_TextFieldName::eType>(
+ text_field.getElement(strings::name).asInt());
+ const std::vector<Common_TextFieldName::eType>::iterator it =
std::find(fields_names.begin(), fields_names.end(), filed_name);
if (it != fields_names.end()) {
fields_names.erase(it);
@@ -223,7 +269,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/send_location_response.cc b/src/components/application_manager/src/commands/mobile/send_location_response.cc
index 32756c999d..167642e390 100644
--- a/src/components/application_manager/src/commands/mobile/send_location_response.cc
+++ b/src/components/application_manager/src/commands/mobile/send_location_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/send_location_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
@@ -40,17 +40,16 @@ namespace application_manager {
namespace commands {
-SendLocationResponse::SendLocationResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SendLocationResponse::SendLocationResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SendLocationResponse::~SendLocationResponse() {
-}
+SendLocationResponse::~SendLocationResponse() {}
void SendLocationResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..40b708e30d 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
@@ -31,38 +31,35 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
#include "application_manager/commands/mobile/set_app_icon_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
-int8_t SetAppIconRequest::is_icons_saving_enabled_ = -1;
-
-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);
- }
+SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , is_icons_saving_enabled_(false) {
+ const std::string path =
+ application_manager_.get_settings().app_icons_folder();
+ is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) &&
+ file_system::IsReadingAllowed(path);
}
-SetAppIconRequest::~SetAppIconRequest() {
-}
+SetAppIconRequest::~SetAppIconRequest() {}
void SetAppIconRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -74,7 +71,7 @@ void SetAppIconRequest::Run() {
(*message_)[strings::msg_params][strings::sync_file_name].asString();
std::string full_file_path =
- profile::Profile::instance()->app_storage_folder() + "/";
+ application_manager_.get_settings().app_storage_folder() + "/";
full_file_path += app->folder_name();
full_file_path += "/";
full_file_path += sync_file_name;
@@ -89,22 +86,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,38 +111,41 @@ void SetAppIconRequest::Run() {
}
void SetAppIconRequest::CopyToIconStorage(
- const std::string& path_to_file) const {
- if (!profile::Profile::instance()->enable_protocol_4()) {
+ const std::string& path_to_file) const {
+ if (!application_manager_.protocol_handler()
+ .get_settings()
+ .enable_protocol_4()) {
LOG4CXX_WARN(logger_,
"Icon copying skipped, since protocol ver. 4 is not enabled.");
return;
}
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());
+ application_manager_.get_settings().app_icons_folder();
+ const uint64_t storage_max_size = static_cast<uint64_t>(
+ application_manager_.get_settings().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();
+ application_manager_.get_settings().app_icons_amount_to_remove();
if (!icons_amount) {
LOG4CXX_DEBUG(logger_,
@@ -159,17 +159,16 @@ void SetAppIconRequest::CopyToIconStorage(
}
}
ApplicationConstSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->
- application(connection_key());
+ application_manager_.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->policy_app_id();
if (!file_system::CreateFile(icon_path)) {
LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path);
return;
@@ -180,8 +179,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 +191,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 +212,56 @@ 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));
+ application_manager_.get_settings().app_icons_folder();
+ const uint64_t storage_max_size = static_cast<uint64_t>(
+ application_manager_.get_settings().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());
+ application_manager_.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_app_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc
index 563490bd46..29f3950ffc 100644
--- a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc
+++ b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/set_app_icon_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SetAppIconResponse::~SetAppIconResponse() {
-}
+SetAppIconResponse::~SetAppIconResponse() {}
void SetAppIconResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
index f3d9e28c04..6cb6318791 100644
--- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
@@ -32,26 +32,23 @@
*/
#include "application_manager/commands/mobile/set_display_layout_request.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application_impl.h"
+#include "application_manager/application_impl.h"
namespace application_manager {
namespace commands {
SetDisplayLayoutRequest::SetDisplayLayoutRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {
-}
+SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {}
void SetDisplayLayoutRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationConstSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -61,8 +58,8 @@ void SetDisplayLayoutRequest::Run() {
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout,
- &((*message_)[strings::msg_params]), true);
-
+ &((*message_)[strings::msg_params]),
+ true);
}
void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
@@ -74,21 +71,25 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event");
mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
+ static_cast<mobile_apis::Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
bool response_success = mobile_apis::Result::SUCCESS == result_code;
smart_objects::SmartObject msg_params = message[strings::msg_params];
if (response_success) {
HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities();
// in case templates_available is empty copy from hmi capabilities
if (msg_params.keyExists(hmi_response::display_capabilities)) {
- if (0 == msg_params[hmi_response::display_capabilities][hmi_response::templates_available].length()) {
- msg_params[hmi_response::display_capabilities][hmi_response::templates_available] =
- hmi_capabilities.display_capabilities()->getElement(hmi_response::templates_available);
+ if (0 ==
+ msg_params[hmi_response::display_capabilities]
+ [hmi_response::templates_available].length()) {
+ msg_params[hmi_response::display_capabilities]
+ [hmi_response::templates_available] =
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::templates_available);
}
}
}
@@ -96,7 +97,7 @@ void SetDisplayLayoutRequest::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;
}
}
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc
index 3844b3bf05..b5e53803c8 100644
--- a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc
+++ b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc
@@ -33,25 +33,21 @@
#include "application_manager/commands/mobile/set_display_layout_response.h"
#include "application_manager/application_impl.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SetDisplayLayoutResponse::SetDisplayLayoutResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {
-}
+SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {}
void SetDisplayLayoutResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
-
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 aef167cb54..171b902df1 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
@@ -34,29 +33,27 @@
#include <string.h>
#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 {
namespace commands {
SetGlobalPropertiesRequest::SetGlobalPropertiesRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- is_ui_send_(false),
- is_tts_send_(false),
- is_ui_received_(false),
- is_tts_received_(false),
- ui_result_(hmi_apis::Common_Result::INVALID_ENUM),
- tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager)
+ , is_ui_send_(false)
+ , is_tts_send_(false)
+ , is_ui_received_(false)
+ , is_tts_received_(false)
+ , ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
-SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {
-}
+SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {}
void SetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -64,13 +61,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 = application_manager_.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;
}
@@ -86,230 +82,144 @@ void SetGlobalPropertiesRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::menu_icon], app);
+ (*message_)[strings::msg_params][strings::menu_icon],
+ app,
+ application_manager_);
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;
}
}
// Check for image file(s) in vrHelpItem
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!" );
+ if (mobile_apis::Result::SUCCESS !=
+ MessageHelper::VerifyImageVrHelpItems(
+ (*message_)[strings::msg_params][strings::vr_help],
+ app,
+ application_manager_)) {
+ 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);
+ // if application waits for sending ttsGlobalProperties need to remove this
+ // application from tts_global_properties_app_list_
+ application_manager_.RemoveAppFromTTSGlobalPropertiesList(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_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);
if (is_help_prompt_present) {
- app->set_help_prompt(
- msg_params.getElement(strings::help_prompt));
+ app->set_help_prompt(msg_params.getElement(strings::help_prompt));
params[strings::help_prompt] = (*app->help_prompt());
}
if (is_timeout_prompt_present) {
- app->set_timeout_prompt(
- msg_params.getElement(strings::timeout_prompt));
+ app->set_timeout_prompt(msg_params.getElement(strings::timeout_prompt));
params[strings::timeout_prompt] = (*app->timeout_prompt());
}
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,65 +241,189 @@ 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 = "Unsupported phoneme type sent in a prompt";
- } 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
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
- if (!application) {
- LOG4CXX_DEBUG(logger_, "NULL pointer.");
- return;
- }
+ SendResponse(
+ result, result_code, return_info, &(message[strings::msg_params]));
+
+ if (!application) {
+ LOG4CXX_DEBUG(logger_, "NULL pointer.");
+ return;
+ }
+
+ if (result) {
+ application->UpdateHash();
+ }
+}
- 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;
+}
+
+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) {
- return params.keyExists(strings::help_prompt)
- || params.keyExists(strings::timeout_prompt)
- || params.keyExists(strings::vr_help_title)
- || params.keyExists(strings::vr_help)
- || params.keyExists(strings::menu_title)
- || params.keyExists(strings::menu_icon)
- || params.keyExists(strings::keyboard_properties);
+ LOG4CXX_AUTO_TRACE(logger_);
+ return params.keyExists(strings::help_prompt) ||
+ params.keyExists(strings::timeout_prompt) ||
+ params.keyExists(strings::vr_help_title) ||
+ params.keyExists(strings::vr_help) ||
+ params.keyExists(strings::menu_title) ||
+ params.keyExists(strings::menu_icon) ||
+ params.keyExists(strings::keyboard_properties);
}
bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
@@ -449,12 +483,11 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
str = (*it_vh)[strings::image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
- "Invalid vr_help image value syntax check failed");
+ "Invalid vr_help image value syntax check failed");
return true;
}
- }
-
- }
+ } // if image exists
+ } // for - vh_array iteration
}
if (msg_params.keyExists(strings::menu_icon)) {
@@ -481,14 +514,12 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
}
-
if (msg_params.keyExists(strings::keyboard_properties)) {
- if (msg_params[strings::keyboard_properties].
- keyExists(strings::limited_character_list)) {
-
+ 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();
+ [strings::limited_character_list].asArray();
smart_objects::SmartArray::const_iterator it_lcl = lcl_array->begin();
smart_objects::SmartArray::const_iterator it_lcl_end = lcl_array->end();
@@ -496,30 +527,30 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it_lcl != it_lcl_end; ++it_lcl) {
str = (*it_lcl).asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid keyboard_properties "
- "limited_character_list syntax check failed");
+ LOG4CXX_ERROR(logger_,
+ "Invalid keyboard_properties "
+ "limited_character_list syntax check failed");
return true;
}
}
}
- if (msg_params[strings::keyboard_properties].
- keyExists(strings::auto_complete_text)) {
-
- str = msg_params[strings::keyboard_properties]
- [strings::auto_complete_text].asCharArray();
+ if (msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_text)) {
+ str =
+ msg_params[strings::keyboard_properties][strings::auto_complete_text]
+ .asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid keyboard_properties "
- "auto_complete_text syntax check failed");
+ LOG4CXX_ERROR(logger_,
+ "Invalid keyboard_properties "
+ "auto_complete_text syntax check failed");
return true;
}
}
-
}
return false;
}
} // namespace commands
-
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc
index 759333385d..5cfbcb2d58 100644
--- a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc
+++ b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc
@@ -32,25 +32,21 @@
*/
#include "application_manager/commands/mobile/set_global_properties_response.h"
-#include "application_manager/application_manager_impl.h"
-
namespace application_manager {
namespace commands {
SetGlobalPropertiesResponse::SetGlobalPropertiesResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {
-}
+SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {}
void SetGlobalPropertiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..85f34aead9 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/set_icon_request.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/application_impl.h"
#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
@@ -43,18 +43,16 @@ namespace application_manager {
namespace commands {
-SetIconRequest::SetIconRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+SetIconRequest::SetIconRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SetIconRequest::~SetIconRequest() {
-}
+SetIconRequest::~SetIconRequest() {}
void SetIconRequest::Run() {
- LOG4CXX_INFO(logger_, "SetIconRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -66,7 +64,7 @@ void SetIconRequest::Run() {
(*message_)[strings::msg_params][strings::sync_file_name].asString();
std::string full_file_path =
- profile::Profile::instance()->app_storage_folder() + "/";
+ application_manager_.get_settings().app_storage_folder() + "/";
full_file_path += app->folder_name();
full_file_path += "/";
full_file_path += sync_file_name;
@@ -77,22 +75,22 @@ void SetIconRequest::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);
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> (SetIconRequest::ImageType::DYNAMIC);
+ static_cast<int32_t>(SetIconRequest::ImageType::DYNAMIC);
// for further use in on_event function
(*message_)[strings::msg_params][strings::sync_file_name] =
@@ -102,7 +100,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()) {
@@ -115,11 +113,11 @@ void SetIconRequest::on_event(const event_engine::Event& event) {
if (result) {
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
- 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_,
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..c140d04f51 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
@@ -32,23 +32,22 @@
*/
#include "application_manager/commands/mobile/set_icon_response.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace application_manager {
namespace commands {
-SetIconResponse::SetIconResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SetIconResponse::SetIconResponse(const MessageSharedPtr& message,
+ ApplicationManager& app_man)
+ : CommandResponseImpl(message, app_man) {}
-SetIconResponse::~SetIconResponse() {
-}
+SetIconResponse::~SetIconResponse() {}
void SetIconResponse::Run() {
- LOG4CXX_INFO(logger_, "SetIconResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
index 536bb755ed..a198ce63c3 100644
--- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/set_media_clock_timer_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -41,18 +41,16 @@ namespace application_manager {
namespace commands {
-SetMediaClockRequest::SetMediaClockRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+SetMediaClockRequest::SetMediaClockRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SetMediaClockRequest::~SetMediaClockRequest() {
-}
+SetMediaClockRequest::~SetMediaClockRequest() {}
void SetMediaClockRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -67,14 +65,14 @@ void SetMediaClockRequest::Run() {
}
if (isDataValid()) {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
// copy entirely msg
msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = app->app_id();
- SendHMIRequest(hmi_apis::FunctionID::UI_SetMediaClockTimer,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true);
} else {
SendResponse(false, mobile_apis::Result::INVALID_DATA);
}
@@ -110,7 +108,6 @@ bool SetMediaClockRequest::isDataValid() {
if (update_mode == mobile_apis::UpdateMode::COUNTUP ||
update_mode == mobile_apis::UpdateMode::COUNTDOWN) {
-
if (!msg_params.keyExists(strings::start_time)) {
LOG4CXX_INFO(logger_, "Invalid data");
return false;
@@ -134,9 +131,9 @@ bool SetMediaClockRequest::isDataValid() {
(msg_params[strings::end_time][strings::seconds].asUInt());
if (((end_time_in_seconds > start_time_in_seconds) &&
- (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) ||
+ (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) ||
((end_time_in_seconds < start_time_in_seconds) &&
- (update_mode == mobile_apis::UpdateMode::COUNTUP))) {
+ (update_mode == mobile_apis::UpdateMode::COUNTUP))) {
LOG4CXX_INFO(logger_, "Invalid data");
return false;
}
diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc
index da6f204da4..30e802a1db 100644
--- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc
+++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc
@@ -32,24 +32,21 @@
*/
#include "application_manager/commands/mobile/set_media_clock_timer_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
SetMediaClockTimerResponse::SetMediaClockTimerResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {
-}
+SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {}
void SetMediaClockTimerResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..2d79e13582 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,11 +31,13 @@
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/policies/policy_handler.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
@@ -43,17 +45,16 @@ namespace application_manager {
namespace commands {
-ShowConstantTBTRequest::ShowConstantTBTRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ShowConstantTBTRequest::ShowConstantTBTRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-ShowConstantTBTRequest::~ShowConstantTBTRequest() {
-}
+ShowConstantTBTRequest::~ShowConstantTBTRequest() {}
void ShowConstantTBTRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
@@ -68,8 +69,8 @@ void ShowConstantTBTRequest::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);
msg_params = (*message_)[strings::msg_params];
if (IsWhiteSpaceExist()) {
@@ -79,10 +80,13 @@ void ShowConstantTBTRequest::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(msg_params, app);
+ MessageHelper::ProcessSoftButtons(msg_params,
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
LOG4CXX_ERROR(logger_, "INVALID_DATA!");
@@ -90,12 +94,10 @@ void ShowConstantTBTRequest::Run() {
return;
}
-
- mobile_apis::Result::eType verification_result =
- mobile_apis::Result::SUCCESS;
+ mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
if (msg_params.keyExists(strings::turn_icon)) {
verification_result = MessageHelper::VerifyImage(
- msg_params[strings::turn_icon], app);
+ msg_params[strings::turn_icon], app, application_manager_);
if (mobile_apis::Result::SUCCESS != verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
@@ -105,7 +107,7 @@ void ShowConstantTBTRequest::Run() {
if (msg_params.keyExists(strings::next_turn_icon)) {
verification_result = MessageHelper::VerifyImage(
- msg_params[strings::next_turn_icon], app);
+ msg_params[strings::next_turn_icon], app, application_manager_);
if (mobile_apis::Result::SUCCESS != verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
@@ -115,8 +117,8 @@ void ShowConstantTBTRequest::Run() {
msg_params[strings::app_id] = app->app_id();
- msg_params[hmi_request::navi_texts] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ msg_params[hmi_request::navi_texts] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
int32_t index = 0;
if (msg_params.keyExists(strings::navigation_text_1)) {
@@ -156,24 +158,24 @@ void ShowConstantTBTRequest::Run() {
}
if (msg_params.keyExists(strings::time_to_destination)) {
- // erase useless param
- msg_params.erase(strings::time_to_destination);
- msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
- static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
- (*message_)[strings::msg_params][strings::time_to_destination];
+ // erase useless param
+ msg_params.erase(strings::time_to_destination);
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
+ static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination);
+ msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ (*message_)[strings::msg_params][strings::time_to_destination];
}
if (msg_params.keyExists(strings::soft_buttons)) {
- MessageHelper::SubscribeApplicationToSoftButton(msg_params, app, function_id());
+ MessageHelper::SubscribeApplicationToSoftButton(
+ msg_params, app, function_id());
}
app->set_tbt_show_command(msg_params);
- SendHMIRequest(hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params,
- true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, true);
}
-
void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
@@ -181,25 +183,31 @@ 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>(
message[strings::params][hmi_response::code].asInt()));
HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ application_manager_.hmi_capabilities();
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()) {
+ 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: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
break;
}
}
@@ -210,8 +218,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) {
- str = (*message_)[strings::msg_params]
- [strings::turn_icon][strings::value].asCharArray();
+ str = (*message_)[strings::msg_params][strings::turn_icon][strings::value]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid turn_icon value syntax check failed");
return true;
@@ -219,8 +227,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) {
- str = (*message_)[strings::msg_params]
- [strings::next_turn_icon][strings::value].asCharArray();
+ str = (*message_)[strings::msg_params][strings::next_turn_icon]
+ [strings::value].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid next_turn_icon value syntax check failed");
@@ -229,8 +237,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_1)) {
- str = (*message_)[strings::msg_params]
- [strings::navigation_text_1].asCharArray();
+ str = (*message_)[strings::msg_params][strings::navigation_text_1]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid navigation_text_1 value syntax check failed");
@@ -239,8 +247,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_2)) {
- str = (*message_)[strings::msg_params]
- [strings::navigation_text_2].asCharArray();
+ str = (*message_)[strings::msg_params][strings::navigation_text_2]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid navigation_text_2 value syntax check failed");
@@ -257,8 +265,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::total_distance)) {
- str = (*message_)[strings::msg_params]
- [strings::total_distance].asCharArray();
+ str =
+ (*message_)[strings::msg_params][strings::total_distance].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid total_distance value syntax check failed");
@@ -266,9 +274,10 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params].keyExists(strings::time_to_destination)) {
- str = (*message_)[strings::msg_params]
- [strings::time_to_destination].asCharArray();
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::time_to_destination)) {
+ str = (*message_)[strings::msg_params][strings::time_to_destination]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid time_to_destination value syntax check failed");
diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc
index e45cd760df..80a36129cf 100644
--- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc
+++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/show_constant_tbt_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -40,17 +40,16 @@ namespace application_manager {
namespace commands {
ShowConstantTBTResponse::ShowConstantTBTResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
-ShowConstantTBTResponse::~ShowConstantTBTResponse() {
-}
+ : CommandResponseImpl(message, application_manager) {}
+
+ShowConstantTBTResponse::~ShowConstantTBTResponse() {}
void ShowConstantTBTResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..467d8d0236 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -30,75 +30,76 @@
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/policies/policy_handler.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 {
namespace commands {
-ShowRequest::ShowRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ShowRequest::ShowRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-ShowRequest::~ShowRequest() {
-}
+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_.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
+ // 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;
}
if (!CheckStringsOfShowRequest()) {
- LOG4CXX_ERROR(logger_, "Incorrect characters in string");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
+ LOG4CXX_ERROR(logger_, "Incorrect characters in string");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
- //ProcessSoftButtons checks strings on the contents incorrect character
+ // ProcessSoftButtons checks strings on the contents incorrect character
mobile_apis::Result::eType processing_result = mobile_apis::Result::SUCCESS;
- if(((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) &&
+ 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);
+ processing_result = MessageHelper::ProcessSoftButtons(
+ (*message_)[strings::msg_params],
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
}
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;
}
- mobile_apis::Result::eType verification_result =
- mobile_apis::Result::SUCCESS;
+ mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
if (((*message_)[strings::msg_params].keyExists(strings::graphic)) &&
- ((*message_)[strings::msg_params]
- [strings::graphic][strings::value].asString()).length()) {
+ ((*message_)[strings::msg_params][strings::graphic][strings::value]
+ .asString()).length()) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::graphic], app);
+ (*message_)[strings::msg_params][strings::graphic],
+ app,
+ application_manager_);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -106,20 +107,22 @@ void ShowRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::secondary_graphic], app);
+ (*message_)[strings::msg_params][strings::secondary_graphic],
+ app,
+ application_manager_);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
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::app_id] = app->app_id();
- msg_params[hmi_request::show_strings] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ msg_params[hmi_request::show_strings] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
int32_t index = 0;
if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) {
@@ -190,7 +193,7 @@ void ShowRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) {
msg_params[strings::secondary_graphic] =
- (*message_)[strings::msg_params][strings::secondary_graphic];
+ (*message_)[strings::msg_params][strings::secondary_graphic];
}
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
@@ -217,34 +220,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());
+ 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,
+ 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;
}
}
@@ -258,7 +264,7 @@ bool ShowRequest::CheckStringsOfShowRequest() {
str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid main_field_4 syntax check failed");
- return false;
+ return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) {
@@ -304,20 +310,20 @@ bool ShowRequest::CheckStringsOfShowRequest() {
}
}
if ((*message_)[strings::msg_params].keyExists(strings::custom_presets)) {
- smart_objects::SmartObject& custom_presets_array =
- (*message_)[strings::msg_params][strings::custom_presets];
- for (size_t i = 0; i < custom_presets_array.length(); ++i) {
- str = custom_presets_array[i].asCharArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed");
- return false;
- }
+ smart_objects::SmartObject& custom_presets_array =
+ (*message_)[strings::msg_params][strings::custom_presets];
+ for (size_t i = 0; i < custom_presets_array.length(); ++i) {
+ str = custom_presets_array[i].asCharArray();
+ if (!CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed");
+ return false;
}
+ }
}
if ((*message_)[strings::msg_params].keyExists(strings::graphic)) {
- str = (*message_)[strings::msg_params]
- [strings::graphic][strings::value].asCharArray();
+ str = (*message_)[strings::msg_params][strings::graphic][strings::value]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid graphic value syntax check failed");
return false;
@@ -325,11 +331,11 @@ bool ShowRequest::CheckStringsOfShowRequest() {
}
if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) {
- str = (*message_)[strings::msg_params]
- [strings::secondary_graphic][strings::value].asCharArray();
+ str = (*message_)[strings::msg_params][strings::secondary_graphic]
+ [strings::value].asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
- "Invalid secondary_graphic value syntax check failed");
+ "Invalid secondary_graphic value syntax check failed");
return false;
}
}
diff --git a/src/components/application_manager/src/commands/mobile/show_response.cc b/src/components/application_manager/src/commands/mobile/show_response.cc
index 0c46cdd83c..8027c908f1 100644
--- a/src/components/application_manager/src/commands/mobile/show_response.cc
+++ b/src/components/application_manager/src/commands/mobile/show_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/show_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
@@ -40,17 +40,16 @@ namespace application_manager {
namespace commands {
-ShowResponse::ShowResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ShowResponse::ShowResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-ShowResponse::~ShowResponse() {
-}
+ShowResponse::~ShowResponse() {}
void ShowResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 c46311c667..3920b49db3 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -32,28 +32,30 @@
*/
#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 {
namespace commands {
-SliderRequest::SliderRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
+SliderRequest::SliderRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
}
-SliderRequest::~SliderRequest() {
-}
+SliderRequest::~SliderRequest() {}
bool SliderRequest::Init() {
-
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ = profile::Profile::instance()->default_timeout() +
+ default_timeout_ =
+ application_manager_.get_settings().default_timeout() +
(*message_)[strings::msg_params][strings::timeout].asUInt();
}
@@ -63,9 +65,8 @@ bool SliderRequest::Init() {
void SliderRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr application =
- application_manager::ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr application = application_manager_.application(
+ (*message_)[strings::params][strings::connection_key].asUInt());
if (!application) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -73,8 +74,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;
@@ -82,9 +83,8 @@ void SliderRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::slider_footer)) {
if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) {
- if ((*message_)[strings::msg_params][strings::num_ticks].asUInt()
- != (*message_)[strings::msg_params]
- [strings::slider_footer].length()) {
+ if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() !=
+ (*message_)[strings::msg_params][strings::slider_footer].length()) {
LOG4CXX_ERROR(logger_, "INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
@@ -98,8 +98,8 @@ void SliderRequest::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);
msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = application->app_id();
@@ -112,46 +112,60 @@ 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());
+ application_manager_.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 mobile_apis::Result::eType response_code =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- smart_objects::SmartObject response_msg_params = message[strings::msg_params];
- if (response_code == mobile_apis::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);
+ const bool is_response_success = 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();
@@ -180,4 +194,3 @@ bool SliderRequest::IsWhiteSpaceExist() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/mobile/slider_response.cc b/src/components/application_manager/src/commands/mobile/slider_response.cc
index 7f0c10b068..2cfcaf48fd 100644
--- a/src/components/application_manager/src/commands/mobile/slider_response.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/slider_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-SliderResponse::SliderResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SliderResponse::SliderResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SliderResponse::~SliderResponse() {
-}
+SliderResponse::~SliderResponse() {}
void SliderResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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 894b97ea9b..01db47909b 100644
--- a/src/components/application_manager/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_request.cc
@@ -33,29 +33,30 @@
#include <string.h>
#include "application_manager/commands/mobile/speak_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 {
namespace commands {
-SpeakRequest::SpeakRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
+SpeakRequest::SpeakRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {
subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
}
-SpeakRequest::~SpeakRequest() {
-}
+SpeakRequest::~SpeakRequest() {}
void SpeakRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
- ->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.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;
}
@@ -72,7 +73,8 @@ void SpeakRequest::Run() {
(*message_)[strings::msg_params][hmi_request::speak_type] =
hmi_apis::Common_MethodName::SPEAK;
SendHMIRequest(hmi_apis::FunctionID::TTS_Speak,
- &message_->getElement(strings::msg_params), true);
+ &message_->getElement(strings::msg_params),
+ true);
}
void SpeakRequest::on_event(const event_engine::Event& event) {
@@ -87,7 +89,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
- ApplicationManagerImpl::instance()->updateRequestTimeout(
+ application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
@@ -99,35 +101,45 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
}
void SpeakRequest::ProcessTTSSpeakResponse(
- const smart_objects::SmartObject& message) {
+ const smart_objects::SmartObject& message) {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
- connection_key());
+ using namespace helpers;
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- bool result = false;
+ hmi_apis::Common_Result::eType hmi_result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- if (mobile_apis::Result::SUCCESS == result_code) {
- result = true;
- }
+ 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 (mobile_apis::Result::UNSUPPORTED_RESOURCE == 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 = "Unsupported phoneme type sent in a prompt";
}
- 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/speak_response.cc b/src/components/application_manager/src/commands/mobile/speak_response.cc
index d99b1d0952..612d32c913 100644
--- a/src/components/application_manager/src/commands/mobile/speak_response.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/speak_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
@@ -40,17 +40,16 @@ namespace application_manager {
namespace commands {
-SpeakResponse::SpeakResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SpeakResponse::SpeakResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SpeakResponse::~SpeakResponse() {
-}
+SpeakResponse::~SpeakResponse() {}
void SpeakResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
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..7ec4e20fbd 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
@@ -32,7 +32,6 @@
*/
#include "application_manager/commands/mobile/subscribe_button_request.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
@@ -40,21 +39,19 @@ namespace commands {
namespace str = strings;
-SubscribeButtonRequest::SubscribeButtonRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+SubscribeButtonRequest::SubscribeButtonRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SubscribeButtonRequest::~SubscribeButtonRequest() {
-}
+SubscribeButtonRequest::~SubscribeButtonRequest() {}
void SubscribeButtonRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.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 +61,22 @@ 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
- << " isn't allowed");
+ 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
- << " isn't allowed by HMI capabilities");
+ 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;
}
@@ -96,11 +94,10 @@ void SubscribeButtonRequest::Run() {
bool SubscribeButtonRequest::IsSubscriptionAllowed(
ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) {
-
if (!app->is_media_application() &&
((mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
- (mobile_apis::ButtonName::SEEKRIGHT == btn_id)||
- (mobile_apis::ButtonName::TUNEUP == btn_id) ||
+ (mobile_apis::ButtonName::SEEKRIGHT == btn_id) ||
+ (mobile_apis::ButtonName::TUNEUP == btn_id) ||
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
@@ -114,12 +111,9 @@ bool SubscribeButtonRequest::CheckHMICapabilities(
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance();
- DCHECK_OR_RETURN(app_mgr, false);
-
- const HMICapabilities& hmi_caps = app_mgr->hmi_capabilities();
+ const HMICapabilities& hmi_caps = application_manager_.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;
}
@@ -129,8 +123,8 @@ bool SubscribeButtonRequest::CheckHMICapabilities(
const size_t length = button_caps.length();
for (size_t i = 0; i < length; ++i) {
const SmartObject& caps = button_caps[i];
- const ButtonName::eType name =
- static_cast<ButtonName::eType>(caps.getElement(hmi_response::button_name).asInt());
+ const ButtonName::eType name = static_cast<ButtonName::eType>(
+ caps.getElement(hmi_response::button_name).asInt());
if (name == button) {
return true;
}
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc
index a3452ef19f..a92e58b19a 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc
@@ -38,12 +38,10 @@ namespace application_manager {
namespace commands {
SubscribeButtonResponse::SubscribeButtonResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SubscribeButtonResponse::~SubscribeButtonResponse() {
-}
+SubscribeButtonResponse::~SubscribeButtonResponse() {}
void SubscribeButtonResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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 a22f7c0dda..485c5d0009 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
@@ -32,62 +32,77 @@
*/
#include "application_manager/commands/mobile/subscribe_vehicle_data_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 {
namespace commands {
SubscribeVehicleDataRequest::SubscribeVehicleDataRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {
-}
+SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {}
#ifdef HMI_DBUS_API
namespace {
- struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
- };
- Subrequest 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},
- };
+struct Subrequest {
+ hmi_apis::FunctionID::eType func_id;
+ const char* str;
+};
+Subrequest 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},
+};
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
void SubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- CommandRequestImpl::connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -103,43 +118,88 @@ void SubscribeVehicleDataRequest::Run() {
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);
- smart_objects::SmartObject response_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- msg_params[strings::app_id] = app->app_id();
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
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);
} else {
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
- "No data in the request");
+ SendResponse(
+ false, mobile_apis::Result::INVALID_DATA, "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,12 +207,26 @@ 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
+ // Generate list of subrequests
for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
const Subrequest& sr = subrequests[i];
- if (true == (*message_)[strings::msg_params].keyExists(sr.str)
- && true == (*message_)[strings::msg_params][sr.str].asBool()) {
+ if (true == (*message_)[strings::msg_params].keyExists(sr.str) &&
+ true == (*message_)[strings::msg_params][sr.str].asBool()) {
HmiRequest hmi_request;
hmi_request.str = sr.str;
hmi_request.func_id = sr.func_id;
@@ -160,24 +234,34 @@ 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)
+ // Send subrequests
+ 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,
- &msg_params, true);
-#endif // #ifdef HMI_DBUS_API
+ &msg_params,
+ true);
+#endif // #ifdef HMI_DBUS_API
}
void SubscribeVehicleDataRequest::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());
+ if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event.");
+ return;
+ }
+
+ ApplicationSharedPtr app =
+ application_manager_.application(CommandRequestImpl::connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer.");
@@ -186,23 +270,24 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
#ifdef HMI_DBUS_API
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[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();
- it != hmi_requests_.end(); ++it) {
+ it != hmi_requests_.end();
+ ++it) {
if (!it->complete) {
all_complete = false;
break;
@@ -210,12 +295,14 @@ void SubscribeVehicleDataRequest::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;
}
@@ -225,7 +312,8 @@ void SubscribeVehicleDataRequest::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;
}
}
@@ -241,53 +329,105 @@ 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 = "Already subscribed on some provided VehicleData.";
}
}
- SendResponse(result,
- result_code,
- return_info,
- &(message[strings::msg_params]));
+ 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
+#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;
}
+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;
+ }
+};
+
+bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
+ const uint32_t param_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SubscribedToIVIPredicate finder(param_id);
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetConstIt it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ return it != accessor.GetData().end();
+}
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc
index c0554c62eb..7ed16407a5 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/subscribe_vehicle_data_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -40,16 +40,14 @@ namespace application_manager {
namespace commands {
SubscribeVehicleDataResponse::SubscribeVehicleDataResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {
-}
+SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {}
void SubscribeVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
new file mode 100644
index 0000000000..8134730eee
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
@@ -0,0 +1,72 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/subscribe_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+SubscribeWayPointsRequest::SubscribeWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
+
+SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {}
+
+void SubscribeWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "An application with connection key "
+ << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if (application_manager_.IsAppSubscribedForWayPoints(app->app_id())) {
+ SendResponse(false, mobile_apis::Result::IGNORED);
+ return;
+ }
+
+ if (application_manager_.IsAnyAppSubscribedForWayPoints()) {
+ application_manager_.SubscribeAppForWayPoints(app->app_id());
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ app->UpdateHash();
+ return;
+ }
+
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, true);
+}
+
+void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ const smart_objects::SmartObject& message = event.smart_object();
+ switch (event.id()) {
+ case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
+ LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints 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;
+ if (result) {
+ application_manager_.SubscribeAppForWayPoints(app->app_id());
+ }
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ if (result) {
+ app->UpdateHash();
+ }
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ break;
+ }
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc
new file mode 100644
index 0000000000..c2e642619a
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc
@@ -0,0 +1,22 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/subscribe_way_points_response.h"
+
+namespace application_manager {
+
+namespace commands {
+
+SubscribeWayPointsResponse::SubscribeWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
+
+SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {}
+
+void SubscribeWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ application_manager_.SendMessageToMobile(message_);
+}
+
+} // 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 c0b8b0ebf7..b9acf5e930 100644
--- a/src/components/application_manager/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/src/commands/mobile/system_request.cc
@@ -31,26 +31,26 @@ Copyright (c) 2013, Ford Motor Company
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/commands/mobile/system_request.h"
+
#include <vector>
#include <string>
-#include <map>
-#include <set>
-#include "application_manager/commands/mobile/system_request.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application_impl.h"
-#include "application_manager/policies/policy_handler.h"
+#include <stdio.h>
+#include <algorithm>
+#include <sstream>
+#include "application_manager/policies/policy_handler_interface.h"
#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"
+#include "utils/custom_string.h"
namespace application_manager {
+CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager")
namespace {
-CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager")
#ifdef ENABLE_LOG
const char* kQueryAppsValidationFailedPrefix =
":QUERY_APPS_VALIDATION_FAILED: ";
@@ -72,11 +72,11 @@ class QueryAppsDataValidator {
typedef std::set<std::string> SynonymsSet;
typedef std::map<std::string, SynonymsSet> SynonymsMap;
- QueryAppsDataValidator(const smart_objects::SmartObject& object,
- const ApplicationManagerImpl& manager)
+ QueryAppsDataValidator(smart_objects::SmartObject& object,
+ const ApplicationManager& manager)
: data_(object), manager_(manager) {}
- bool Validate() const {
+ bool Validate() {
LOG4CXX_AUTO_TRACE(logger_);
if (!data_.isValid()) {
LOG4CXX_ERROR(logger_,
@@ -102,19 +102,25 @@ class QueryAppsDataValidator {
return true;
}
- bool ValidateAppDataAndOsAndLanguagesData() const {
- const smart_objects::SmartArray* objects_array =
- data_[json::response].asArray();
+ bool ValidateAppDataAndOsAndLanguagesData() {
+ smart_objects::SmartArray* objects_array = data_[json::response].asArray();
+
if (!objects_array) {
LOG4CXX_WARN(logger_,
kQueryAppsValidationFailedPrefix
<< "QueryApps response is not array.");
return false;
}
- const std::size_t arr_size(objects_array->size());
+
SynonymsMap synonyms_map;
- for (std::size_t idx = 0; idx < arr_size; ++idx) {
- const smart_objects::SmartObject& app_data = (*objects_array)[idx];
+ bool has_response_valid_application = false;
+
+ smart_objects::SmartArray::iterator applications_iterator =
+ objects_array->begin();
+
+ for (; applications_iterator != objects_array->end();
+ ++applications_iterator) {
+ const smart_objects::SmartObject& app_data = *applications_iterator;
if (!app_data.isValid()) {
LOG4CXX_WARN(logger_,
@@ -122,59 +128,50 @@ class QueryAppsDataValidator {
<< "Wrong application data in json file.");
return false;
}
- std::set<std::string> app_ids_set;
- if (!ValidateAppIdAndAppName(app_data, app_ids_set)) {
+
+ if (!CheckMandatoryParametersPresent(app_data)) {
+ LOG4CXX_WARN(logger_,
+ "Application hasn`t some of mandatory parameters. "
+ "Application will be skipped.");
+ objects_array->erase(applications_iterator);
+ continue;
+ }
+
+ if (!ValidateAppIdAndAppName(app_data)) {
return false;
}
+
+ // If we dont have any of android/ios field
+ // we skip this json in CheckMandatoryParametersPresent
+ const std::string os_type =
+ (app_data.keyExists(json::android)) ? json::android : json::ios;
+
// Verify os and dependent languages data
- std::string os_type;
- if (app_data.keyExists(json::ios)) {
- os_type = json::ios;
- if (!app_data[os_type].keyExists(json::urlScheme)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Can't find URL scheme in json file.");
- return false;
- }
- if (app_data[os_type][json::urlScheme].asString().length() >
+ if (json::ios == os_type) {
+ if (app_data[json::ios][json::urlScheme].asString().length() >
kUrlSchemaLengthMax) {
LOG4CXX_WARN(
logger_,
kQueryAppsValidationFailedPrefix
<< "An urlscheme length exceeds maximum allowed ["
- << app_data[os_type][json::urlScheme].asString().length()
+ << app_data[json::ios][json::urlScheme].asString().length()
<< "]>[" << kUrlSchemaLengthMax << "]");
return false;
}
}
- if (os_type.empty()) {
- if (app_data.keyExists(json::android)) {
- os_type = json::android;
- if (!app_data[os_type].keyExists(json::packageName)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Can't find package name in json file.");
- return false;
- }
- if (app_data[json::android][json::packageName].asString().length() >
- kPackageNameLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Package name length ["
- << app_data[json::android][json::packageName]
- .asString()
- .length() << "] exceeds max length ["
- << kPackageNameLengthMax << "]in json file.");
- return false;
- }
- }
- }
- if (os_type.empty()) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Can't find mobile OS type in json file.");
- return false;
+ if (json::android == os_type) {
+ if (app_data[json::android][json::packageName].asString().length() >
+ kPackageNameLengthMax) {
+ LOG4CXX_WARN(logger_,
+ kQueryAppsValidationFailedPrefix
+ << "Package name length ["
+ << app_data[json::android][json::packageName]
+ .asString()
+ .length() << "] exceeds max length ["
+ << kPackageNameLengthMax << "]in json file.");
+ return false;
+ }
}
// Languages verification
@@ -188,19 +185,12 @@ class QueryAppsDataValidator {
synonyms_map)) {
return false;
}
+ has_response_valid_application = true;
}
- return true;
+ return has_response_valid_application;
}
- bool ValidateAppIdAndAppName(const smart_objects::SmartObject& app_data,
- std::set<std::string>& app_ids_set) const {
- // Verify appid
- if (!app_data.keyExists(json::appId)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Can't find app ID in json file.");
- return false;
- }
+ bool ValidateAppIdAndAppName(const smart_objects::SmartObject& app_data) {
// Verify appid length
const std::string app_id(app_data[json::appId].asString());
if (app_id.length() > kAppIdLengthMax) {
@@ -212,30 +202,21 @@ class QueryAppsDataValidator {
}
// Verify that appid is unique
- if (app_ids_set.find(app_id) != app_ids_set.end()) {
+ if (applications_id_set_.find(app_id) != applications_id_set_.end()) {
LOG4CXX_WARN(logger_,
kQueryAppsValidationFailedPrefix
<< "An Object ID is not unigue [" << app_id << "]");
return false;
}
- app_ids_set.insert(app_id);
+ applications_id_set_.insert(app_id);
// Verify that app is not registered yet
ApplicationSharedPtr registered_app =
manager_.application_by_policy_id(app_id);
if (registered_app) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Application with the same id: " << app_id
- << " is registered already.");
- return false;
- }
- // Verify app name exist
- if (!app_data.keyExists(json::name)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Can't find app name in json file.");
- return false;
+ LOG4CXX_INFO(logger_,
+ "Application with the id: " << app_id
+ << " is already registered.");
}
// And app name length
const std::string appName(app_data[json::name].asString());
@@ -404,8 +385,36 @@ class QueryAppsDataValidator {
return true;
}
- const smart_objects::SmartObject& data_;
- const ApplicationManagerImpl& manager_;
+ bool CheckMandatoryParametersPresent(
+ const smart_objects::SmartObject& app_data) const {
+ if (!app_data.keyExists(json::android) && !app_data.keyExists(json::ios)) {
+ return false;
+ }
+
+ if (app_data.keyExists(json::android) &&
+ !app_data[json::android].keyExists(json::packageName)) {
+ return false;
+ }
+
+ if (app_data.keyExists(json::ios) &&
+ !app_data[json::ios].keyExists(json::urlScheme)) {
+ return false;
+ }
+
+ if (!app_data.keyExists(json::appId)) {
+ return false;
+ }
+
+ if (!app_data.keyExists(json::name)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ smart_objects::SmartObject& data_;
+ std::set<std::string> applications_id_set_;
+ const ApplicationManager& manager_;
DISALLOW_COPY_AND_ASSIGN(QueryAppsDataValidator);
};
@@ -413,23 +422,24 @@ class QueryAppsDataValidator {
namespace commands {
+namespace custom_str = utils::custom_string;
+
uint32_t SystemRequest::index = 0;
const std::string kSYNC = "SYNC";
const std::string kIVSU = "IVSU";
-SystemRequest::SystemRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+SystemRequest::SystemRequest(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-SystemRequest::~SystemRequest() {
-}
+SystemRequest::~SystemRequest() {}
void SystemRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!(application.valid())) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -441,8 +451,10 @@ void SystemRequest::Run() {
static_cast<mobile_apis::RequestType::eType>(
(*message_)[strings::msg_params][strings::request_type].asInt());
- if (!policy::PolicyHandler::instance()->IsRequestTypeAllowed(
- application->mobile_app_id(), request_type)) {
+ const policy::PolicyHandlerInterface& policy_handler =
+ application_manager_.GetPolicyHandler();
+ if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(),
+ request_type)) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
@@ -469,15 +481,18 @@ void SystemRequest::Run() {
std::string binary_data_folder;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
- binary_data_folder = profile::Profile::instance()->system_files_path();
+ binary_data_folder =
+ application_manager_.get_settings().system_files_path();
} else {
- binary_data_folder = profile::Profile::instance()->app_storage_folder();
+ binary_data_folder =
+ application_manager_.get_settings().app_storage_folder();
binary_data_folder += "/";
binary_data_folder += application->folder_name();
binary_data_folder += "/";
}
- std::string file_dst_path = profile::Profile::instance()->system_files_path();
+ std::string file_dst_path =
+ application_manager_.get_settings().system_files_path();
file_dst_path += "/";
file_dst_path += file_name;
@@ -486,7 +501,7 @@ void SystemRequest::Run() {
logger_,
"Binary data is present. Trying to save it to: " << binary_data_folder);
if (mobile_apis::Result::SUCCESS !=
- (ApplicationManagerImpl::instance()->SaveBinary(
+ (application_manager_.SaveBinary(
binary_data, binary_data_folder, file_name, 0))) {
LOG4CXX_DEBUG(logger_, "Binary data can't be saved.");
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
@@ -524,7 +539,15 @@ void SystemRequest::Run() {
LOG4CXX_DEBUG(logger_, "Binary data ok.");
- if (mobile_apis::RequestType::QUERY_APPS == request_type) {
+ if (mobile_apis::RequestType::HTTP == request_type &&
+ (*message_)[strings::msg_params].keyExists(strings::file_name)) {
+ const std::string& file =
+ (*message_)[strings::msg_params][strings::file_name].asString();
+ application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(file,
+ binary_data);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ return;
+ } else if (mobile_apis::RequestType::QUERY_APPS == request_type) {
using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
smart_objects::SmartObject sm_object;
@@ -542,8 +565,7 @@ void SystemRequest::Run() {
return;
}
- ApplicationManagerImpl::instance()->ProcessQueryApp(sm_object,
- connection_key());
+ application_manager_.ProcessQueryApp(sm_object, connection_key());
SendResponse(true, mobile_apis::Result::SUCCESS);
return;
}
@@ -557,7 +579,7 @@ void SystemRequest::Run() {
}
if (mobile_apis::RequestType::PROPRIETARY != request_type) {
- msg_params[strings::app_id] = (application->mobile_app_id());
+ msg_params[strings::app_id] = (application->policy_app_id());
}
msg_params[strings::request_type] =
(*message_)[strings::msg_params][strings::request_type];
@@ -584,7 +606,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
mobile_api::Result::WARNINGS);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ application_manager_.application(connection_key());
if (!(application.valid())) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -595,6 +617,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
file_system::DeleteFile(processing_file_);
processing_file_.clear();
}
+
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
break;
}
@@ -606,7 +629,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
}
bool SystemRequest::ValidateQueryAppData(
- const smart_objects::SmartObject& data) const {
+ smart_objects::SmartObject& data) const {
if (!data.isValid()) {
LOG4CXX_ERROR(logger_,
kQueryAppsValidationFailedPrefix
@@ -620,10 +643,8 @@ bool SystemRequest::ValidateQueryAppData(
<< json::response << "' parameter.");
return false;
}
- ApplicationManagerImpl* manager = ApplicationManagerImpl::instance();
- DCHECK(manager);
- QueryAppsDataValidator validator(data, *manager);
+ QueryAppsDataValidator validator(data, application_manager_);
return validator.Validate();
}
diff --git a/src/components/application_manager/src/commands/mobile/system_response.cc b/src/components/application_manager/src/commands/mobile/system_response.cc
index 8b4fdafd1b..f5bc03f4a5 100644
--- a/src/components/application_manager/src/commands/mobile/system_response.cc
+++ b/src/components/application_manager/src/commands/mobile/system_response.cc
@@ -32,23 +32,21 @@
*/
#include "application_manager/commands/mobile/system_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
-SystemResponse::SystemResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+SystemResponse::SystemResponse(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-SystemResponse::~SystemResponse() {
-}
+SystemResponse::~SystemResponse() {}
void SystemResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc
index dc63a11941..d7056a624e 100644
--- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/unregister_app_interface_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/message_helper.h"
namespace application_manager {
@@ -42,19 +42,19 @@ namespace commands {
void UnregisterAppInterfaceRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance();
-
- if (!app_manager->application(connection_key())) {
+ if (!application_manager_.application(connection_key())) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
LOG4CXX_ERROR(logger_, "Application is not registered");
return;
}
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- connection_key(),
- mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM);
- app_manager->UnregisterApplication(connection_key(),
- mobile_apis::Result::SUCCESS);
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ connection_key(),
+ mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(connection_key(),
+ mobile_apis::Result::SUCCESS);
SendResponse(true, mobile_apis::Result::SUCCESS);
}
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..86df8fabb1 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
@@ -32,7 +32,7 @@
*/
#include "application_manager/commands/mobile/unsubscribe_button_request.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
namespace application_manager {
@@ -42,21 +42,18 @@ namespace commands {
namespace str = strings;
UnsubscribeButtonRequest::UnsubscribeButtonRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {
-}
+UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {}
void UnsubscribeButtonRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationSharedPtr app = application_manager_.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,13 +61,15 @@ void UnsubscribeButtonRequest::Run() {
const uint32_t btn_id =
(*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);
+ if (!app->IsSubscribedToButton(
+ static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
+ LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
- app->UnsubscribeFromButton(static_cast<mobile_apis::ButtonName::eType>(btn_id));
+ app->UnsubscribeFromButton(
+ static_cast<mobile_apis::ButtonName::eType>(btn_id));
SendUnsubscribeButtonNotification();
const bool is_succedeed = true;
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc
index 8bece66157..409579b294 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc
@@ -32,19 +32,16 @@
*/
#include "application_manager/commands/mobile/unsubscribe_button_response.h"
-#include "application_manager/application_manager_impl.h"
namespace application_manager {
namespace commands {
UnsubscribeButtonResponse::UnsubscribeButtonResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {
-}
+UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {}
void UnsubscribeButtonResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
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 051f1819ba..4fcc04c7be 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
@@ -33,65 +33,81 @@
#include "application_manager/commands/mobile/unsubscribe_vehicle_data_request.h"
#include "application_manager/commands/command_impl.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 "application_manager/smart_object_keys.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
-UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {
-}
+UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {}
#ifdef HMI_DBUS_API
namespace {
- struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
- };
- Subrequest subrequests[] = {
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel, strings::fuel_level},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State, strings::fuel_level_state},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption, strings::instant_fuel_consumption},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature, strings::external_temp},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure, strings::tire_pressure},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus, strings::belt_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation, strings::body_information},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus, strings::device_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking, strings::driver_braking},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus, strings::wiper_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus, strings::head_lamp_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque, strings::engine_torque},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition, strings::acc_pedal_pos},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle, strings::steering_wheel_angle},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo, strings::e_call_info},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus, strings::airbag_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent, strings::emergency_event},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus, strings::cluster_mode_status},
- { hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key},
- };
+struct Subrequest {
+ hmi_apis::FunctionID::eType func_id;
+ const char* str;
+};
+Subrequest subrequests[] = {
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel,
+ strings::fuel_level},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State,
+ strings::fuel_level_state},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption,
+ strings::instant_fuel_consumption},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature,
+ strings::external_temp},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure,
+ strings::tire_pressure},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus,
+ strings::belt_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation,
+ strings::body_information},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus,
+ strings::device_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking,
+ strings::driver_braking},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus,
+ strings::wiper_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus,
+ strings::head_lamp_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque,
+ strings::engine_torque},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition,
+ strings::acc_pedal_pos},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle,
+ strings::steering_wheel_angle},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo,
+ strings::e_call_info},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus,
+ strings::airbag_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent,
+ strings::emergency_event},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus,
+ strings::cluster_mode_status},
+ {hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key},
+};
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
void UnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- CommandRequestImpl::connection_key());
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -99,62 +115,111 @@ 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();
VehicleData::const_iterator it = vehicle_data.begin();
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- smart_objects::SmartObject response_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();
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
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);
} else {
- SendResponse(false, mobile_apis::Result::INVALID_DATA,
- "No data in the request.");
+ SendResponse(
+ false, mobile_apis::Result::INVALID_DATA, "No data in the request.");
}
return;
- } else if (0 == unsubscribed_items) {
- SendResponse(false, mobile_apis::Result::IGNORED,
- "Was not subscribed on any VehicleData.", &response_params);
+ }
+
+ 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
+ // Generate list of subrequests
for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
const Subrequest& sr = subrequests[i];
- if (true == (*message_)[strings::msg_params].keyExists(sr.str)
- && true == (*message_)[strings::msg_params][sr.str].asBool()) {
+ if (true == (*message_)[strings::msg_params].keyExists(sr.str) &&
+ true == (*message_)[strings::msg_params][sr.str].asBool()) {
HmiRequest hmi_request;
hmi_request.str = sr.str;
hmi_request.func_id = sr.func_id;
@@ -165,40 +230,49 @@ void UnsubscribeVehicleDataRequest::Run() {
LOG4CXX_INFO(logger_,
hmi_requests_.size() << " requests are going to be sent to HMI");
- //Send subrequests
+ // Send subrequests
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);
#else
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
- &msg_params, true);
-#endif // #ifdef HMI_DBUS_API
+ &msg_params,
+ true);
+#endif // #ifdef HMI_DBUS_API
}
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;
+ 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[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();
- it != hmi_requests_.end(); ++it) {
+ it != hmi_requests_.end();
+ ++it) {
if (!it->complete) {
all_complete = false;
break;
@@ -206,73 +280,129 @@ void UnsubscribeVehicleDataRequest::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;
}
}
- if (all_complete) {
+ if (all_complete) {
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");
+ 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 = "Some provided VehicleData was not subscribed.";
}
}
- SendResponse(result, result_code, return_info,
- &(message[strings::msg_params]));
-#endif // #ifdef HMI_DBUS_API
+ 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");
+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;
+ }
+};
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
+bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
+ const uint32_t param_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SubscribedToIVIPredicate finder(param_id);
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetConstIt it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ return it != accessor.GetData().end();
+}
- 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;
- }
- }
+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;
}
- return false;
+ 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;
+ }
}
+void UnsubscribeVehicleDataRequest::UpdateHash() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+ if (application) {
+ application->UpdateHash();
+ } else {
+ LOG4CXX_ERROR(logger_,
+ "Application with connection_key = " << connection_key()
+ << " doesn't exist.");
+ }
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
+}
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc
index 87b2e6e5e1..e06158e4eb 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc
@@ -37,12 +37,10 @@ namespace application_manager {
namespace commands {
UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse(
- const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {
-}
+UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {}
void UnsubscribeVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
new file mode 100644
index 0000000000..b19e292025
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -0,0 +1,65 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/unsubscribe_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
+
+UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {}
+
+void UnSubscribeWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "An application with connection key "
+ << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if (!application_manager_.IsAppSubscribedForWayPoints(app->app_id())) {
+ SendResponse(false, mobile_apis::Result::IGNORED);
+ return;
+ }
+
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
+}
+
+void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ const smart_objects::SmartObject& message = event.smart_object();
+ switch (event.id()) {
+ case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
+ LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints 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;
+ if (result) {
+ application_manager_.UnsubscribeAppFromWayPoints(app->app_id());
+ }
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ if (result) {
+ app->UpdateHash();
+ }
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ break;
+ }
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc
new file mode 100644
index 0000000000..f6430d1f0d
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc
@@ -0,0 +1,22 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/mobile/unsubscribe_way_points_response.h"
+
+namespace application_manager {
+
+namespace commands {
+
+UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
+
+UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {}
+
+void UnsubscribeWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ application_manager_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
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..9b3b221446 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
@@ -33,27 +33,30 @@
#include <string>
#include "application_manager/commands/mobile/update_turn_list_request.h"
-#include "application_manager/application_manager_impl.h"
+
+#include "application_manager/policies/policy_handler.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/custom_string.h"
namespace application_manager {
namespace commands {
-UpdateTurnListRequest::UpdateTurnListRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+namespace custom_str = utils::custom_string;
-UpdateTurnListRequest::~UpdateTurnListRequest() {
-}
+UpdateTurnListRequest::UpdateTurnListRequest(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandRequestImpl(message, application_manager) {}
+
+UpdateTurnListRequest::~UpdateTurnListRequest() {}
void UpdateTurnListRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
@@ -69,10 +72,13 @@ 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);
+ MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params],
+ app,
+ application_manager_.GetPolicyHandler(),
+ application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
LOG4CXX_ERROR(logger_, "INVALID_DATA!");
@@ -84,20 +90,21 @@ 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,
+ application_manager_))) {
+ 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 +116,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 +132,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 +157,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();
+ application_manager_.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 +184,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 +209,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 +219,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/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc
index 26e5c460d3..d40a4546fc 100644
--- a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc
+++ b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc
@@ -32,24 +32,23 @@
*/
#include "application_manager/commands/mobile/update_turn_list_response.h"
-#include "application_manager/application_manager_impl.h"
+
#include "interfaces/HMI_API.h"
namespace application_manager {
namespace commands {
-UpdateTurnListResponse::UpdateTurnListResponse(const MessageSharedPtr& message)
- : CommandResponseImpl(message) {
-}
+UpdateTurnListResponse::UpdateTurnListResponse(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : CommandResponseImpl(message, application_manager) {}
-UpdateTurnListResponse::~UpdateTurnListResponse() {
-}
+UpdateTurnListResponse::~UpdateTurnListResponse() {}
void UpdateTurnListResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+ application_manager_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/pending.cc b/src/components/application_manager/src/commands/pending.cc
index 0c04464af3..c410a84fa5 100644
--- a/src/components/application_manager/src/commands/pending.cc
+++ b/src/components/application_manager/src/commands/pending.cc
@@ -37,13 +37,9 @@ namespace application_manager {
namespace commands {
+Pending::Pending() : last_(hmi_apis::FunctionID::INVALID_ENUM) {}
-Pending::Pending()
-: last_(hmi_apis::FunctionID::INVALID_ENUM) {
-}
-
-Pending::~Pending() {
-}
+Pending::~Pending() {}
void Pending::Add(hmi_apis::FunctionID::eType id) {
sync_primitives::AutoLock L(lock_);
diff --git a/src/components/application_manager/src/event_engine/event.cc b/src/components/application_manager/src/event_engine/event.cc
index 561e8a841f..cc180ca950 100644
--- a/src/components/application_manager/src/event_engine/event.cc
+++ b/src/components/application_manager/src/event_engine/event.cc
@@ -36,21 +36,17 @@
namespace application_manager {
namespace event_engine {
-Event::Event(const EventID& id)
-: id_(id)
-, response_so_() {
-}
+Event::Event(const EventID& id) : id_(id), response_so_() {}
-Event::~Event() {
-}
+Event::~Event() {}
-void Event::raise() {
- EventDispatcher::instance()->raise_event(*this);
+void Event::raise(EventDispatcher& event_dispatcher) {
+ event_dispatcher.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..f8b8bc791d
--- /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& 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& 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& 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& 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..f89f6649b1 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,15 +30,16 @@
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"
+#include "application_manager/event_engine/event_dispatcher.h"
namespace application_manager {
namespace event_engine {
-EventObserver::EventObserver()
- : id_(0) {
- //Get unique id based on this
+EventObserver::EventObserver(EventDispatcher& event_dispatcher)
+ : id_(0), event_dispatcher_(event_dispatcher) {
+ // Get unique id based on this
id_ = reinterpret_cast<unsigned long>(this);
}
@@ -48,16 +49,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);
+ event_dispatcher_.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);
+ event_dispatcher_.remove_observer(event_id, *this);
}
void EventObserver::unsubscribe_from_all_events() {
- EventDispatcher::instance()->remove_observer(this);
+ event_dispatcher_.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..7535984c16 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
@@ -37,142 +37,145 @@
#include "json/json.h"
#include "utils/file_system.h"
#include "interfaces/HMI_API.h"
-#include "config_profile/profile.h"
#include "smart_objects/smart_object.h"
#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/smart_object_keys.h"
+#include "application_manager/application_manager.h"
+#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}
-};
-
-std::map<std::string, hmi_apis::Common_ButtonName::eType> button_enum_name =
-{
- {"OK" , hmi_apis::Common_ButtonName::OK},
- {"SEEKLEFT" , hmi_apis::Common_ButtonName::SEEKLEFT},
- {"SEEKRIGHT" , hmi_apis::Common_ButtonName::SEEKRIGHT},
- {"TUNEUP" , hmi_apis::Common_ButtonName::TUNEUP},
- {"TUNEDOWN" , hmi_apis::Common_ButtonName::TUNEDOWN},
- {"PRESET_0" , hmi_apis::Common_ButtonName::PRESET_0},
- {"PRESET_1" , hmi_apis::Common_ButtonName::PRESET_1},
- {"PRESET_2" , hmi_apis::Common_ButtonName::PRESET_2},
- {"PRESET_3" , hmi_apis::Common_ButtonName::PRESET_3},
- {"PRESET_4" , hmi_apis::Common_ButtonName::PRESET_4},
- {"PRESET_5" , hmi_apis::Common_ButtonName::PRESET_5},
- {"PRESET_6" , hmi_apis::Common_ButtonName::PRESET_6},
- {"PRESET_7" , hmi_apis::Common_ButtonName::PRESET_7},
- {"PRESET_8" , hmi_apis::Common_ButtonName::PRESET_8},
- {"PRESET_9" , hmi_apis::Common_ButtonName::PRESET_9},
- {"CUSTOM_BUTTON" , hmi_apis::Common_ButtonName::CUSTOM_BUTTON},
- {"SEARCH" , hmi_apis::Common_ButtonName::SEARCH},
+std::map<std::string, hmi_apis::Common_VrCapabilities::eType>
+ vr_enum_capabilities = {{"TEXT", hmi_apis::Common_VrCapabilities::VR_TEXT}};
+
+std::map<std::string, hmi_apis::Common_ButtonName::eType> button_enum_name = {
+ {"OK", hmi_apis::Common_ButtonName::OK},
+ {"SEEKLEFT", hmi_apis::Common_ButtonName::SEEKLEFT},
+ {"SEEKRIGHT", hmi_apis::Common_ButtonName::SEEKRIGHT},
+ {"TUNEUP", hmi_apis::Common_ButtonName::TUNEUP},
+ {"TUNEDOWN", hmi_apis::Common_ButtonName::TUNEDOWN},
+ {"PRESET_0", hmi_apis::Common_ButtonName::PRESET_0},
+ {"PRESET_1", hmi_apis::Common_ButtonName::PRESET_1},
+ {"PRESET_2", hmi_apis::Common_ButtonName::PRESET_2},
+ {"PRESET_3", hmi_apis::Common_ButtonName::PRESET_3},
+ {"PRESET_4", hmi_apis::Common_ButtonName::PRESET_4},
+ {"PRESET_5", hmi_apis::Common_ButtonName::PRESET_5},
+ {"PRESET_6", hmi_apis::Common_ButtonName::PRESET_6},
+ {"PRESET_7", hmi_apis::Common_ButtonName::PRESET_7},
+ {"PRESET_8", hmi_apis::Common_ButtonName::PRESET_8},
+ {"PRESET_9", hmi_apis::Common_ButtonName::PRESET_9},
+ {"CUSTOM_BUTTON", hmi_apis::Common_ButtonName::CUSTOM_BUTTON},
+ {"SEARCH", hmi_apis::Common_ButtonName::SEARCH},
};
-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},
+ {{"RATE_8KHZ", hmi_apis::Common_SamplingRate::RATE_8KHZ},
+ {"8KHZ", hmi_apis::Common_SamplingRate::RATE_8KHZ},
+ {"RATE_16KHZ", hmi_apis::Common_SamplingRate::RATE_16KHZ},
+ {"16KHZ", hmi_apis::Common_SamplingRate::RATE_16KHZ},
+ {"RATE_22KHZ", hmi_apis::Common_SamplingRate::RATE_22KHZ},
+ {"22KHZ", hmi_apis::Common_SamplingRate::RATE_22KHZ},
+ {"RATE_44KHZ", hmi_apis::Common_SamplingRate::RATE_44KHZ},
+ {"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},
+ {"8_BIT", hmi_apis::Common_BitsPerSample::RATE_8_BIT},
+ {"RATE_16_BIT", hmi_apis::Common_BitsPerSample::RATE_16_BIT},
+ {"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,69 +183,61 @@ 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}
-};
-
-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) {
-
- if (false == load_capabilities_from_file()) {
- LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
- } else {
- LOG4CXX_INFO(logger_, "file hmi_capabilities.json was loaded");
- }
- if (false == profile::Profile::instance()->launch_hmi()) {
+ {"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(ApplicationManager& 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)
+ , pcm_stream_capabilities_(NULL)
+ , prerecorded_speech_(NULL)
+ , is_navigation_supported_(false)
+ , is_phone_call_supported_(false)
+ , app_mngr_(app_mngr)
+ , hmi_language_handler_(app_mngr_) {
+ if (false == app_mngr_.get_settings().launch_hmi()) {
is_vr_ready_response_recieved_ = true;
is_tts_ready_response_recieved_ = true;
is_ui_ready_response_recieved_ = true;
@@ -270,16 +265,16 @@ HMICapabilities::~HMICapabilities() {
delete vr_capabilities_;
delete speech_capabilities_;
delete audio_pass_thru_capabilities_;
+ delete pcm_stream_capabilities_;
delete prerecorded_speech_;
- app_mngr_ = NULL;
}
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 +290,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 +314,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;
@@ -336,14 +331,18 @@ void HMICapabilities::set_is_vr_cooperating(bool value) {
is_vr_cooperating_ = value;
if (is_vr_cooperating_) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage));
- app_mngr_->ManageHMICommand(get_language);
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage,
+ app_mngr_));
+ 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));
- app_mngr_->ManageHMICommand(get_all_languages);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages, app_mngr_));
+ app_mngr_.ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities));
- app_mngr_->ManageHMICommand(get_capabilities);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VR_GetCapabilities, app_mngr_));
+ app_mngr_.ManageHMICommand(get_capabilities);
}
}
@@ -352,17 +351,18 @@ void HMICapabilities::set_is_tts_cooperating(bool value) {
is_tts_cooperating_ = value;
if (is_tts_cooperating_) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetLanguage));
- app_mngr_->ManageHMICommand(get_language);
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage,
+ app_mngr_));
+ 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));
- app_mngr_->ManageHMICommand(get_all_languages);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages, app_mngr_));
+ app_mngr_.ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetCapabilities));
- app_mngr_->ManageHMICommand(get_capabilities);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::TTS_GetCapabilities, app_mngr_));
+ app_mngr_.ManageHMICommand(get_capabilities);
}
}
@@ -371,17 +371,18 @@ void HMICapabilities::set_is_ui_cooperating(bool value) {
is_ui_cooperating_ = value;
if (is_ui_cooperating_) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetLanguage));
- app_mngr_->ManageHMICommand(get_language);
+ MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage,
+ app_mngr_));
+ 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));
- app_mngr_->ManageHMICommand(get_all_languages);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages, app_mngr_));
+ app_mngr_.ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetCapabilities));
- app_mngr_->ManageHMICommand(get_capabilities);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::UI_GetCapabilities, app_mngr_));
+ app_mngr_.ManageHMICommand(get_capabilities);
}
}
@@ -395,9 +396,9 @@ 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));
- app_mngr_->ManageHMICommand(get_type);
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType, app_mngr_));
+ app_mngr_.ManageHMICommand(get_type);
}
}
@@ -406,18 +407,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 +464,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 +489,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 +498,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 +531,17 @@ 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_pcm_stream_capabilities(
+ const smart_objects::SmartObject& pcm_stream_capabilities) {
+ if (pcm_stream_capabilities_) {
+ delete pcm_stream_capabilities_;
+ }
+ pcm_stream_capabilities_ =
+ new smart_objects::SmartObject(pcm_stream_capabilities);
}
void HMICapabilities::set_preset_bank_capabilities(
@@ -509,12 +549,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 +562,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,22 +570,32 @@ void HMICapabilities::set_prerecorded_speech(
prerecorded_speech_ = new smart_objects::SmartObject(prerecorded_speech);
}
-void HMICapabilities::set_navigation_supported(bool supported) {
+void HMICapabilities::set_ccpu_version(const std::string& ccpu_version) {
+ ccpu_version_ = ccpu_version;
+}
+
+void HMICapabilities::set_navigation_supported(const bool supported) {
is_navigation_supported_ = supported;
}
-void HMICapabilities::set_phone_call_supported(bool supported) {
+void HMICapabilities::set_phone_call_supported(const bool supported) {
is_phone_call_supported_ = supported;
}
-void HMICapabilities::set_ccpu_version(const std::string& ccpu_version) {
- ccpu_version_ = ccpu_version;
+void HMICapabilities::Init(resumption::LastState* last_state) {
+ hmi_language_handler_.Init(last_state);
+ if (false == load_capabilities_from_file()) {
+ LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
+ } else {
+ LOG4CXX_INFO(logger_, "file hmi_capabilities.json was loaded");
+ }
+ hmi_language_handler_.set_default_capabilities_languages(
+ ui_language_, vr_language_, tts_language_);
}
bool HMICapabilities::load_capabilities_from_file() {
std::string json_string;
- std::string file_name =
- profile::Profile::instance()->hmi_capabilities_file_name();
+ std::string file_name = app_mngr_.get_settings().hmi_capabilities_file_name();
if (!file_system::FileExists(file_name)) {
return false;
@@ -556,9 +606,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 +618,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 +633,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 +653,35 @@ 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 +692,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 +724,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 +745,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,54 +768,79 @@ 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"] =
- bit_per_sample_enum.find(
- audio_capabilities.get("bitsPerSample", "").asString())->second;
+ audio_capabilities_so["bitsPerSample"] =
+ bit_per_sample_enum.find(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);
}
+ if (check_existing_json_member(ui, "pcmStreamCapabilities")) {
+ Json::Value pcm_capabilities = ui.get("pcmStreamCapabilities", "");
+ smart_objects::SmartObject pcm_capabilities_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (check_existing_json_member(pcm_capabilities, "samplingRate")) {
+ pcm_capabilities_so["samplingRate"] =
+ sampling_rate_enum.find(pcm_capabilities.get("samplingRate", "")
+ .asString())->second;
+ }
+ if (check_existing_json_member(pcm_capabilities, "bitsPerSample")) {
+ pcm_capabilities_so["bitsPerSample"] =
+ bit_per_sample_enum.find(pcm_capabilities.get("bitsPerSample", "")
+ .asString())->second;
+ }
+ if (check_existing_json_member(pcm_capabilities, "audioType")) {
+ pcm_capabilities_so["audioType"] =
+ audio_type_enum.find(pcm_capabilities.get("audioType", "")
+ .asString())->second;
+ }
+
+ set_pcm_stream_capabilities(pcm_capabilities_so);
+ }
+
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 +862,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 +885,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 +893,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 +913,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 +934,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 2fc3499c09..67625fde88 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"
@@ -193,7 +193,7 @@
#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h"
#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h"
#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h"
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
#include "application_manager/commands/hmi/vi_get_dtcs_request.h"
#include "application_manager/commands/hmi/vi_get_dtcs_response.h"
@@ -209,6 +209,12 @@
#include "application_manager/commands/hmi/navi_alert_maneuver_response.h"
#include "application_manager/commands/hmi/navi_update_turn_list_request.h"
#include "application_manager/commands/hmi/navi_update_turn_list_response.h"
+#include "application_manager/commands/hmi/navi_subscribe_way_points_request.h"
+#include "application_manager/commands/hmi/navi_subscribe_way_points_response.h"
+#include "application_manager/commands/hmi/navi_unsubscribe_way_points_request.h"
+#include "application_manager/commands/hmi/navi_unsubscribe_way_points_response.h"
+#include "application_manager/commands/hmi/navi_get_way_points_request.h"
+#include "application_manager/commands/hmi/navi_get_way_points_response.h"
#include "application_manager/commands/hmi/on_ready_notification.h"
#include "application_manager/commands/hmi/on_device_chosen_notification.h"
#include "application_manager/commands/hmi/on_file_removed_notification.h"
@@ -216,7 +222,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"
@@ -228,6 +233,7 @@
#include "application_manager/commands/hmi/on_vr_language_change_notification.h"
#include "application_manager/commands/hmi/on_tts_language_change_notification.h"
#include "application_manager/commands/hmi/on_navi_tbt_client_state_notification.h"
+#include "application_manager/commands/hmi/on_navi_way_point_change_notification.h"
#include "application_manager/commands/hmi/on_button_event_notification.h"
#include "application_manager/commands/hmi/on_button_press_notification.h"
#include "application_manager/commands/hmi/on_button_subscription_notification.h"
@@ -263,1815 +269,1973 @@
#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"
#include "application_manager/commands/hmi/dial_number_request.h"
#include "application_manager/commands/hmi/dial_number_response.h"
-namespace application_manager {
-
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_,
- "HMICommandFactory::CreateCommand function_id: " << function_id);
+ const commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager) {
+ const int function_id =
+ (*message)[strings::params][strings::function_id].asInt();
+ LOG4CXX_DEBUG(
+ logger_, "HMICommandFactory::CreateCommand function_id: " << function_id);
- CommandSharedPtr command(
- new application_manager::commands::CommandImpl(message));
+ CommandSharedPtr command(new application_manager::commands::CommandImpl(
+ message, application_manager));
bool is_response = false;
- const int msg_type = (*message)[strings::params][strings::message_type].asInt();
- if (msg_type == static_cast<int>(application_manager::MessageType::kResponse)) {
+ 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");
- } else if ((*message)[strings::params][strings::message_type]
- == static_cast<int>(application_manager::MessageType::kErrorResponse)) {
+ 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) {
case hmi_apis::FunctionID::BasicCommunication_OnStartDeviceDiscovery: {
- command.reset(new commands::OnStartDeviceDiscovery(message));
+ command.reset(
+ new commands::OnStartDeviceDiscovery(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList: {
if (is_response) {
- command.reset(new commands::UpdateDeviceListResponse(message));
+ command.reset(new commands::UpdateDeviceListResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UpdateDeviceListRequest(message));
+ command.reset(new commands::UpdateDeviceListRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_ActivateApp: {
if (is_response) {
- command.reset(new commands::ActivateAppResponse(message));
+ command.reset(
+ new commands::ActivateAppResponse(message, application_manager));
} else {
- command.reset(new commands::ActivateAppRequest(message));
+ command.reset(
+ new commands::ActivateAppRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_GetSystemInfo: {
if (is_response) {
- command.reset(new commands::GetSystemInfoResponse(message));
+ command.reset(
+ new commands::GetSystemInfoResponse(message, application_manager));
} else {
- command.reset(new commands::GetSystemInfoRequest(message));
+ command.reset(
+ new commands::GetSystemInfoRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_ActivateApp: {
if (is_response) {
- command.reset(new commands::SDLActivateAppResponse(message));
+ command.reset(
+ new commands::SDLActivateAppResponse(message, application_manager));
} else {
- command.reset(new commands::SDLActivateAppRequest(message));
+ command.reset(
+ new commands::SDLActivateAppRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_PolicyUpdate: {
if (is_response) {
- command.reset(new commands::SDLPolicyUpdateResponse(message));
+ command.reset(new commands::SDLPolicyUpdateResponse(
+ message, application_manager));
} else {
- command.reset(new commands::SDLPolicyUpdate(message));
+ command.reset(
+ new commands::SDLPolicyUpdate(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_GetURLS: {
if (is_response) {
- command.reset(new commands::GetUrlsResponse(message));
+ command.reset(
+ new commands::GetUrlsResponse(message, application_manager));
} else {
- command.reset(new commands::GetUrls(message));
+ command.reset(new commands::GetUrls(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_OnAppPermissionChanged: {
- command.reset(new commands::OnAppPermissionChangedNotification(message));
+ command.reset(new commands::OnAppPermissionChangedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_GetListOfPermissions: {
if (is_response) {
- command.reset(new commands::SDLGetListOfPermissionsResponse(message));
+ command.reset(new commands::SDLGetListOfPermissionsResponse(
+ message, application_manager));
} else {
- command.reset(new commands::SDLGetListOfPermissionsRequest(message));
+ command.reset(new commands::SDLGetListOfPermissionsRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_GetUserFriendlyMessage: {
if (is_response) {
- command.reset(new commands::SDLGetUserFriendlyMessageResponse(message));
+ command.reset(new commands::SDLGetUserFriendlyMessageResponse(
+ message, application_manager));
} else {
- command.reset(new commands::SDLGetUserFriendlyMessageRequest(message));
+ command.reset(new commands::SDLGetUserFriendlyMessageRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_GetStatusUpdate: {
if (is_response) {
- command.reset(new commands::SDLGetStatusUpdateResponse(message));
+ command.reset(new commands::SDLGetStatusUpdateResponse(
+ message, application_manager));
} else {
- command.reset(new commands::SDLGetStatusUpdateRequest(message));
+ command.reset(new commands::SDLGetStatusUpdateRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_OnStatusUpdate: {
- command.reset(new commands::OnStatusUpdateNotification(message));
+ command.reset(new commands::OnStatusUpdateNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnAppPermissionConsent: {
- command.reset(new commands::OnAppPermissionConsentNotification(message));
+ command.reset(new commands::OnAppPermissionConsentNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported: {
if (is_response) {
- command.reset(new commands::MixingAudioSupportedResponse(message));
+ command.reset(new commands::MixingAudioSupportedResponse(
+ message, application_manager));
} else {
- command.reset(new commands::MixingAudioSupportedRequest(message));
+ command.reset(new commands::MixingAudioSupportedRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnExitAllApplications: {
- command.reset(new commands::OnExitAllApplicationsNotification(message));
+ command.reset(new commands::OnExitAllApplicationsNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_AddCommand: {
if (is_response) {
- command.reset(new commands::UIAddCommandResponse(message));
+ command.reset(
+ new commands::UIAddCommandResponse(message, application_manager));
} else {
- command.reset(new commands::UIAddCommandRequest(message));
+ command.reset(
+ new commands::UIAddCommandRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_DeleteCommand: {
if (is_response) {
- command.reset(new commands::UIDeleteCommandResponse(message));
+ command.reset(new commands::UIDeleteCommandResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIDeleteCommandRequest(message));
+ command.reset(
+ new commands::UIDeleteCommandRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_AddSubMenu: {
if (is_response) {
- command.reset(new commands::UIAddSubmenuResponse(message));
+ command.reset(
+ new commands::UIAddSubmenuResponse(message, application_manager));
} else {
- command.reset(new commands::UIAddSubmenuRequest(message));
+ command.reset(
+ new commands::UIAddSubmenuRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_DeleteSubMenu: {
if (is_response) {
- command.reset(new commands::UIDeleteSubmenuResponse(message));
+ command.reset(new commands::UIDeleteSubmenuResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIDeleteSubmenuRequest(message));
+ command.reset(
+ new commands::UIDeleteSubmenuRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_SetMediaClockTimer: {
if (is_response) {
- command.reset(new commands::UISetMediaClockTimerResponse(message));
+ command.reset(new commands::UISetMediaClockTimerResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UISetMediaClockTimerRequest(message));
+ command.reset(new commands::UISetMediaClockTimerRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_PerformInteraction: {
if (is_response) {
- command.reset(new commands::UIPerformInteractionResponse(message));
+ command.reset(new commands::UIPerformInteractionResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIPerformInteractionRequest(message));
+ command.reset(new commands::UIPerformInteractionRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
if (is_response) {
- command.reset(new commands::UISetGlobalPropertiesResponse(message));
+ command.reset(new commands::UISetGlobalPropertiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UISetGlobalPropertiesRequest(message));
+ command.reset(new commands::UISetGlobalPropertiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_ScrollableMessage: {
if (is_response) {
- command.reset(new commands::UIScrollableMessageResponse(message));
+ command.reset(new commands::UIScrollableMessageResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIScrollableMessageRequest(message));
+ command.reset(new commands::UIScrollableMessageRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_SetAppIcon: {
if (is_response) {
- command.reset(new commands::UISetAppIconResponse(message));
+ command.reset(
+ new commands::UISetAppIconResponse(message, application_manager));
} else {
- command.reset(new commands::UISetAppIconRequest(message));
+ command.reset(
+ new commands::UISetAppIconRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_GetSupportedLanguages: {
if (is_response) {
- command.reset(new commands::UIGetSupportedLanguagesResponse(message));
+ command.reset(new commands::UIGetSupportedLanguagesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIGetSupportedLanguagesRequest(message));
+ command.reset(new commands::UIGetSupportedLanguagesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_GetLanguage: {
if (is_response) {
- command.reset(new commands::UIGetLanguageResponse(message));
+ command.reset(
+ new commands::UIGetLanguageResponse(message, application_manager));
} else {
- command.reset(new commands::UIGetLanguageRequest(message));
+ command.reset(
+ new commands::UIGetLanguageRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_GetCapabilities: {
if (is_response) {
- command.reset(new commands::UIGetCapabilitiesResponse(message));
+ command.reset(new commands::UIGetCapabilitiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIGetCapabilitiesRequest(message));
+ command.reset(new commands::UIGetCapabilitiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_ChangeRegistration: {
if (is_response) {
- command.reset(new commands::UIChangeRegistratioResponse(message));
+ command.reset(new commands::UIChangeRegistratioResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIChangeRegistrationRequest(message));
+ command.reset(new commands::UIChangeRegistrationRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
if (is_response) {
- command.reset(new commands::UIPerformAudioPassThruResponse(message));
+ command.reset(new commands::UIPerformAudioPassThruResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIPerformAudioPassThruRequest(message));
+ command.reset(new commands::UIPerformAudioPassThruRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_EndAudioPassThru: {
if (is_response) {
- command.reset(new commands::UIEndAudioPassThruResponse(message));
+ command.reset(new commands::UIEndAudioPassThruResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UIEndAudioPassThruRequest(message));
+ command.reset(new commands::UIEndAudioPassThruRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_Alert: {
if (is_response) {
- command.reset(new commands::UIAlertResponse(message));
+ command.reset(
+ new commands::UIAlertResponse(message, application_manager));
} else {
- command.reset(new commands::UIAlertRequest(message));
+ command.reset(
+ new commands::UIAlertRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_IsReady: {
if (is_response) {
- command.reset(new commands::VRIsReadyResponse(message));
+ command.reset(
+ new commands::VRIsReadyResponse(message, application_manager));
} else {
- command.reset(new commands::VRIsReadyRequest(message));
+ command.reset(
+ new commands::VRIsReadyRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_AddCommand: {
if (is_response) {
- command.reset(new commands::VRAddCommandResponse(message));
+ command.reset(
+ new commands::VRAddCommandResponse(message, application_manager));
} else {
- command.reset(new commands::VRAddCommandRequest(message));
+ command.reset(
+ new commands::VRAddCommandRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_DeleteCommand: {
if (is_response) {
- command.reset(new commands::VRDeleteCommandResponse(message));
+ command.reset(new commands::VRDeleteCommandResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VRDeleteCommandRequest(message));
+ command.reset(
+ new commands::VRDeleteCommandRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_ChangeRegistration: {
if (is_response) {
- command.reset(new commands::VRChangeRegistrationResponse(message));
+ command.reset(new commands::VRChangeRegistrationResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VRChangeRegistrationRequest(message));
+ command.reset(new commands::VRChangeRegistrationRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_GetSupportedLanguages: {
if (is_response) {
- command.reset(new commands::VRGetSupportedLanguagesResponse(message));
+ command.reset(new commands::VRGetSupportedLanguagesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VRGetSupportedLanguagesRequest(message));
+ command.reset(new commands::VRGetSupportedLanguagesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_GetLanguage: {
if (is_response) {
- command.reset(new commands::VRGetLanguageResponse(message));
+ command.reset(
+ new commands::VRGetLanguageResponse(message, application_manager));
} else {
- command.reset(new commands::VRGetLanguageRequest(message));
+ command.reset(
+ new commands::VRGetLanguageRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_GetCapabilities: {
if (is_response) {
- command.reset(new commands::VRGetCapabilitiesResponse(message));
+ command.reset(new commands::VRGetCapabilitiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VRGetCapabilitiesRequest(message));
+ command.reset(new commands::VRGetCapabilitiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_IsReady: {
if (is_response) {
- command.reset(new commands::TTSIsReadyResponse(message));
+ command.reset(
+ new commands::TTSIsReadyResponse(message, application_manager));
} else {
- command.reset(new commands::TTSIsReadyRequest(message));
+ command.reset(
+ new commands::TTSIsReadyRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
if (is_response) {
- command.reset(new commands::TTSChangeRegistratioResponse(message));
+ command.reset(new commands::TTSChangeRegistratioResponse(
+ message, application_manager));
} else {
- command.reset(new commands::TTSChangeRegistrationRequest(message));
+ command.reset(new commands::TTSChangeRegistrationRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_GetSupportedLanguages: {
if (is_response) {
- command.reset(new commands::TTSGetSupportedLanguagesResponse(message));
+ command.reset(new commands::TTSGetSupportedLanguagesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::TTSGetSupportedLanguagesRequest(message));
+ command.reset(new commands::TTSGetSupportedLanguagesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
if (is_response) {
- command.reset(new commands::TTSStopSpeakingResponse(message));
+ command.reset(new commands::TTSStopSpeakingResponse(
+ message, application_manager));
} else {
- command.reset(new commands::TTSStopSpeakingRequest(message));
+ command.reset(
+ new commands::TTSStopSpeakingRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_GetLanguage: {
if (is_response) {
- command.reset(new commands::TTSGetLanguageResponse(message));
+ command.reset(
+ new commands::TTSGetLanguageResponse(message, application_manager));
} else {
- command.reset(new commands::TTSGetLanguageRequest(message));
+ command.reset(
+ new commands::TTSGetLanguageRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
if (is_response) {
- command.reset(new commands::TTSSpeakResponse(message));
+ command.reset(
+ new commands::TTSSpeakResponse(message, application_manager));
} else {
- command.reset(new commands::TTSSpeakRequest(message));
+ command.reset(
+ new commands::TTSSpeakRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
if (is_response) {
- command.reset(new commands::TTSSetGlobalPropertiesResponse(message));
+ command.reset(new commands::TTSSetGlobalPropertiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::TTSSetGlobalPropertiesRequest(message));
+ command.reset(new commands::TTSSetGlobalPropertiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_GetCapabilities: {
if (is_response) {
- command.reset(new commands::TTSGetCapabilitiesResponse(message));
+ command.reset(new commands::TTSGetCapabilitiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::TTSGetCapabilitiesRequest(message));
+ command.reset(new commands::TTSGetCapabilitiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::TTS_Started: {
- command.reset(new commands::OnTTSStartedNotification(message));
+ command.reset(
+ new commands::OnTTSStartedNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::TTS_Stopped: {
- command.reset(new commands::OnTTSStoppedNotification(message));
+ command.reset(
+ new commands::OnTTSStoppedNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnAppActivated: {
- command.reset(new commands::OnAppActivatedNotification(message));
+ command.reset(new commands::OnAppActivatedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: {
- command.reset(new commands::OnExitApplicationNotification(message));
+ command.reset(new commands::OnExitApplicationNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_Show: {
if (is_response) {
- command.reset(new commands::UIShowResponse(message));
+ command.reset(
+ new commands::UIShowResponse(message, application_manager));
} else {
- command.reset(new commands::UIShowRequest(message));
+ command.reset(
+ new commands::UIShowRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_Slider: {
if (is_response) {
- command.reset(new commands::UISliderResponse(message));
+ command.reset(
+ new commands::UISliderResponse(message, application_manager));
} else {
- command.reset(new commands::UISliderRequest(message));
+ command.reset(
+ new commands::UISliderRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_ClosePopUp: {
if (is_response) {
- command.reset(new commands::ClosePopupResponse(message));
+ command.reset(
+ new commands::ClosePopupResponse(message, application_manager));
} else {
- command.reset(new commands::ClosePopupRequest(message));
+ command.reset(
+ new commands::ClosePopupRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::UI_IsReady: {
if (is_response) {
- command.reset(new commands::UIIsReadyResponse(message));
+ command.reset(
+ new commands::UIIsReadyResponse(message, application_manager));
} else {
- command.reset(new commands::UIIsReadyRequest(message));
+ command.reset(
+ new commands::UIIsReadyRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VehicleInfo_IsReady: {
if (is_response) {
- command.reset(new commands::VIIsReadyResponse(message));
+ command.reset(
+ new commands::VIIsReadyResponse(message, application_manager));
} else {
- command.reset(new commands::VIIsReadyRequest(message));
+ command.reset(
+ new commands::VIIsReadyRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VehicleInfo_ReadDID: {
if (is_response) {
- command.reset(new commands::VIReadDIDResponse(message));
+ command.reset(
+ new commands::VIReadDIDResponse(message, application_manager));
} else {
- command.reset(new commands::VIReadDIDRequest(message));
+ command.reset(
+ new commands::VIReadDIDRequest(message, application_manager));
}
break;
}
#ifdef HMI_DBUS_API
case hmi_apis::FunctionID::VehicleInfo_GetGpsData: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetGpsData > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message,
+ application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetGpsData > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message,
+ application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetSpeed: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetSpeed > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message,
+ application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetSpeed > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message,
+ application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetRpm: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetRpm > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetRpm>(message,
+ application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetRpm > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetRpm>(message,
+ application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetFuelLevel: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption > (
- message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption > (
- message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature > (
- message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature > (
- message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetPrndl: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetPrndl > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message,
+ application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetPrndl > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message,
+ application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetVin: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetVin > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetVin>(message,
+ application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetVin > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetVin>(message,
+ application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetTirePressure: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetTirePressure>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetTirePressure>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetOdometer: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetOdometer > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetOdometer>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetOdometer > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetOdometer>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetBeltStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetBodyInformation: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetDriverBraking: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetWiperStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetEngineTorque: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition > (
- message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition > (
- message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle > (
- message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle > (
- message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetECallInfo: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetECallInfo>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetECallInfo>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus > (
- message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus > (
- message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetMyKey: {
if (is_response)
- command.reset(
- new commands::VIGetVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetMyKey > (message));
+ command.reset(new commands::VIGetVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message,
+ application_manager));
else
- command.reset(
- new commands::VIGetVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_GetMyKey > (message));
+ command.reset(new commands::VIGetVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message,
+ application_manager));
break;
}
#else
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
if (is_response) {
- command.reset(new commands::VIGetVehicleDataResponse(message));
+ command.reset(new commands::VIGetVehicleDataResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VIGetVehicleDataRequest(message));
+ command.reset(new commands::VIGetVehicleDataRequest(
+ message, application_manager));
}
break;
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
case hmi_apis::FunctionID::VehicleInfo_GetDTCs: {
if (is_response) {
- command.reset(new commands::VIGetDTCsResponse(message));
+ command.reset(
+ new commands::VIGetDTCsResponse(message, application_manager));
} else {
- command.reset(new commands::VIGetDTCsRequest(message));
+ command.reset(
+ new commands::VIGetDTCsRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: {
if (is_response) {
- command.reset(new commands::VIDiagnosticMessageResponse(message));
+ command.reset(new commands::VIDiagnosticMessageResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VIDiagnosticMessageRequest(message));
+ command.reset(new commands::VIDiagnosticMessageRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VehicleInfo_GetVehicleType: {
if (is_response) {
- command.reset(new commands::VIGetVehicleTypeResponse(message));
+ command.reset(new commands::VIGetVehicleTypeResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VIGetVehicleTypeRequest(message));
+ command.reset(new commands::VIGetVehicleTypeRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_IsReady: {
if (is_response) {
- command.reset(new commands::NaviIsReadyResponse(message));
+ command.reset(
+ new commands::NaviIsReadyResponse(message, application_manager));
} else {
- command.reset(new commands::NaviIsReadyRequest(message));
+ command.reset(
+ new commands::NaviIsReadyRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
if (is_response) {
- command.reset(new commands::NaviAlertManeuverResponse(message));
+ command.reset(new commands::NaviAlertManeuverResponse(
+ message, application_manager));
+ } else {
+ command.reset(new commands::NaviAlertManeuverRequest(
+ message, application_manager));
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::Navigation_GetWayPoints: {
+ if (is_response) {
+ command.reset(new commands::NaviGetWayPointsResponse(
+ message, application_manager));
} else {
- command.reset(new commands::NaviAlertManeuverRequest(message));
+ command.reset(new commands::NaviGetWayPointsRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_UpdateTurnList: {
if (is_response) {
- command.reset(new commands::NaviUpdateTurnListResponse(message));
+ command.reset(new commands::NaviUpdateTurnListResponse(
+ message, application_manager));
} else {
- command.reset(new commands::NaviUpdateTurnListRequest(message));
+ command.reset(new commands::NaviUpdateTurnListRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_ShowConstantTBT: {
if (is_response) {
- command.reset(new commands::NaviShowConstantTBTResponse(message));
+ command.reset(new commands::NaviShowConstantTBTResponse(
+ message, application_manager));
+ } else {
+ command.reset(new commands::NaviShowConstantTBTRequest(
+ message, application_manager));
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
+ if (is_response) {
+ command.reset(new commands::NaviSubscribeWayPointsResponse(
+ message, application_manager));
+ } else {
+ command.reset(new commands::NaviSubscribeWayPointsRequest(
+ message, application_manager));
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
+ if (is_response) {
+ command.reset(new commands::NaviUnsubscribeWayPointsResponse(
+ message, application_manager));
} else {
- command.reset(new commands::NaviShowConstantTBTRequest(message));
+ command.reset(new commands::NaviUnSubscribeWayPointsRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Buttons_GetCapabilities: {
if (is_response) {
- command.reset(new commands::ButtonGetCapabilitiesResponse(message));
+ command.reset(new commands::ButtonGetCapabilitiesResponse(
+ message, application_manager));
} else {
- command.reset(new commands::ButtonGetCapabilitiesRequest(message));
+ command.reset(new commands::ButtonGetCapabilitiesRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality: {
- command.reset(new commands::OnAllowSDLFunctionalityNotification(message));
+ command.reset(new commands::OnAllowSDLFunctionalityNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnSDLConsentNeeded: {
- command.reset(new commands::OnSDLConsentNeededNotification(message));
+ command.reset(new commands::OnSDLConsentNeededNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_UpdateSDL: {
if (is_response) {
- command.reset(new commands::UpdateSDLResponse(message));
+ command.reset(
+ new commands::UpdateSDLResponse(message, application_manager));
} else {
- command.reset(new commands::UpdateSDLRequest(message));
+ command.reset(
+ new commands::UpdateSDLRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnIgnitionCycleOver: {
- command.reset(new commands::OnIgnitionCycleOverNotification(message));
+ command.reset(new commands::OnIgnitionCycleOverNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnSystemInfoChanged: {
- 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));
+ command.reset(new commands::OnSystemInfoChangedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- command.reset(new commands::OnReadyNotification(message));
+ command.reset(
+ new commands::OnReadyNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnDeviceChosen: {
- command.reset(new commands::OnDeviceChosenNotification(message));
+ command.reset(new commands::OnDeviceChosenNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnSystemContext: {
- command.reset(new commands::OnSystemContextNotification(message));
+ command.reset(new commands::OnSystemContextNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnDriverDistraction: {
- command.reset(
- new commands::hmi::OnDriverDistractionNotification(message));
+ command.reset(new commands::hmi::OnDriverDistractionNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnUpdateDeviceList: {
- command.reset(new commands::OnUpdateDeviceList(message));
+ command.reset(
+ new commands::OnUpdateDeviceList(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: {
- command.reset(new commands::OnAppRegisteredNotification(message));
+ command.reset(new commands::OnAppRegisteredNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered: {
- command.reset(new commands::OnAppUnregisteredNotification(message));
+ command.reset(new commands::OnAppUnregisteredNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnFindApplications: {
- command.reset(new commands::OnFindApplications(message));
+ command.reset(
+ new commands::OnFindApplications(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_UpdateAppList: {
if (is_response) {
- command.reset(new commands::UpdateAppListResponse(message));
+ command.reset(
+ new commands::UpdateAppListResponse(message, application_manager));
} else {
- command.reset(new commands::UpdateAppListRequest(message));
+ command.reset(
+ new commands::UpdateAppListRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::VR_Started: {
- command.reset(new commands::OnVRStartedNotification(message));
+ command.reset(
+ new commands::OnVRStartedNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VR_Stopped: {
- command.reset(new commands::OnVRStoppedNotification(message));
+ command.reset(
+ new commands::OnVRStoppedNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VR_OnCommand: {
- command.reset(new commands::OnVRCommandNotification(message));
+ command.reset(
+ new commands::OnVRCommandNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnCommand: {
- command.reset(new commands::OnUICommandNotification(message));
+ command.reset(
+ new commands::OnUICommandNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated: {
- command.reset(new commands::OnAppDeactivatedNotification(message));
+ command.reset(new commands::OnAppDeactivatedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnLanguageChange: {
- command.reset(new commands::OnUILanguageChangeNotification(message));
+ command.reset(new commands::OnUILanguageChangeNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VR_OnLanguageChange: {
- command.reset(new commands::OnVRLanguageChangeNotification(message));
+ command.reset(new commands::OnVRLanguageChangeNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::TTS_OnLanguageChange: {
- command.reset(new commands::OnTTSLanguageChangeNotification(message));
+ command.reset(new commands::OnTTSLanguageChangeNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::Buttons_OnButtonEvent: {
- command.reset(new commands::hmi::OnButtonEventNotification(message));
+ command.reset(new commands::hmi::OnButtonEventNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::Buttons_OnButtonPress: {
- command.reset(new commands::hmi::OnButtonPressNotification(message));
+ command.reset(new commands::hmi::OnButtonPressNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::Buttons_OnButtonSubscription: {
- command.reset(new commands::hmi::OnButtonSubscriptionNotification(message));
+ command.reset(new commands::hmi::OnButtonSubscriptionNotification(
+ message, application_manager));
break;
}
#ifdef HMI_DBUS_API
case hmi_apis::FunctionID::VehicleInfo_SubscribeGps: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeGps>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeGps>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeRpm: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribePrndl: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribePrndl > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribePrndl > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeVin: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVin>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVin>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus > (
- message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey: {
if (is_response)
- command.reset(
- new commands::VISubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey > (message));
+ command.reset(new commands::VISubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>(
+ message, application_manager));
else
- command.reset(
- new commands::VISubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey > (message));
+ command.reset(new commands::VISubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>(
+ message, application_manager));
break;
}
#else
case hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData: {
if (is_response) {
- command.reset(new commands::VISubscribeVehicleDataResponse(message));
+ command.reset(new commands::VISubscribeVehicleDataResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VISubscribeVehicleDataRequest(message));
+ command.reset(new commands::VISubscribeVehicleDataRequest(
+ message, application_manager));
}
break;
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
#ifdef HMI_DBUS_API
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::
+ VehicleInfo_UnsubscribeInstantFuelConsumption>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::
+ VehicleInfo_UnsubscribeInstantFuelConsumption>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus > (
- message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey: {
if (is_response)
- command.reset(
- new commands::VIUnsubscribeVehicleDataResponseTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>(
+ message, application_manager));
else
- command.reset(
- new commands::VIUnsubscribeVehicleDataRequestTemplate <
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey > (message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate<
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>(
+ message, application_manager));
break;
}
#else
case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData: {
if (is_response) {
- command.reset(new commands::VIUnsubscribeVehicleDataResponse(message));
+ command.reset(new commands::VIUnsubscribeVehicleDataResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VIUnsubscribeVehicleDataRequest(message));
+ command.reset(new commands::VIUnsubscribeVehicleDataRequest(
+ message, application_manager));
}
break;
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
#ifdef HMI_DBUS_API
case hmi_apis::FunctionID::VehicleInfo_OnGpsData: {
- command.reset(new commands::OnVIGpsDataNotification(message));
+ command.reset(
+ new commands::OnVIGpsDataNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnSpeed: {
- command.reset(new commands::OnVISpeedNotification(message));
+ command.reset(
+ new commands::OnVISpeedNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnRpm: {
- command.reset(new commands::OnVIRpmNotification(message));
+ command.reset(
+ new commands::OnVIRpmNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnFuelLevel: {
- command.reset(new commands::OnVIFuelLevelNotification(message));
+ command.reset(new commands::OnVIFuelLevelNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnFuelLevelState: {
- command.reset(new commands::OnVIFuelLevelStateNotification(message));
+ command.reset(new commands::OnVIFuelLevelStateNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnInstantFuelConsumption: {
- command.reset(
- new commands::OnVIInstantFuelConsumptionNotification(message));
+ command.reset(new commands::OnVIInstantFuelConsumptionNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnExternalTemperature: {
- command.reset(new commands::OnVIExternalTemperatureNotification(message));
+ command.reset(new commands::OnVIExternalTemperatureNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnVin: {
- command.reset(new commands::OnVIVinNotification(message));
+ command.reset(
+ new commands::OnVIVinNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnPrndl: {
- command.reset(new commands::OnVIPrndlNotification(message));
+ command.reset(
+ new commands::OnVIPrndlNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnTirePressure: {
- command.reset(new commands::OnVITirePressureNotification(message));
+ command.reset(new commands::OnVITirePressureNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnOdometer: {
- command.reset(new commands::OnVIOdometerNotification(message));
+ command.reset(
+ new commands::OnVIOdometerNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnBeltStatus: {
- command.reset(new commands::OnVIBeltStatusNotification(message));
+ command.reset(new commands::OnVIBeltStatusNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnBodyInformation: {
- command.reset(new commands::OnVIBodyInformationNotification(message));
+ command.reset(new commands::OnVIBodyInformationNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnDeviceStatus: {
- command.reset(new commands::OnVIDeviceStatusNotification(message));
+ command.reset(new commands::OnVIDeviceStatusNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnDriverBraking: {
- command.reset(new commands::OnVIDriverBrakingNotification(message));
+ command.reset(new commands::OnVIDriverBrakingNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnWiperStatus: {
- command.reset(new commands::OnVIWiperStatusNotification(message));
+ command.reset(new commands::OnVIWiperStatusNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnHeadLampStatus: {
- command.reset(new commands::OnVIHeadLampStatusNotification(message));
+ command.reset(new commands::OnVIHeadLampStatusNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnEngineTorque: {
- command.reset(new commands::OnVIEngineTorqueNotification(message));
+ command.reset(new commands::OnVIEngineTorqueNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnAccPedalPosition: {
- command.reset(new commands::OnVIAccPedalPositionNotification(message));
+ command.reset(new commands::OnVIAccPedalPositionNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnSteeringWheelAngle: {
- command.reset(new commands::OnVISteeringWheelAngleNotification(message));
+ command.reset(new commands::OnVISteeringWheelAngleNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VehicleInfo_OnMyKey: {
- command.reset(new commands::OnVIMyKeyNotification(message));
+ command.reset(
+ new commands::OnVIMyKeyNotification(message, application_manager));
break;
}
#else
case hmi_apis::FunctionID::VehicleInfo_OnVehicleData: {
- command.reset(new commands::OnVIVehicleDataNotification(message));
+ command.reset(new commands::OnVIVehicleDataNotification(
+ message, application_manager));
break;
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
case hmi_apis::FunctionID::Navigation_OnTBTClientState: {
- command.reset(new commands::OnNaviTBTClientStateNotification(message));
+ command.reset(new commands::OnNaviTBTClientStateNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnKeyboardInput: {
- command.reset(new commands::hmi::OnUIKeyBoardInputNotification(message));
+ command.reset(new commands::hmi::OnUIKeyBoardInputNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnTouchEvent: {
- command.reset(new commands::hmi::OnUITouchEventNotification(message));
+ command.reset(new commands::hmi::OnUITouchEventNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- command.reset(new commands::hmi::OnUIResetTimeoutNotification(message));
+ command.reset(new commands::hmi::OnUIResetTimeoutNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::Navigation_StartStream: {
if (is_response) {
- command.reset(new commands::NaviStartStreamResponse(message));
+ command.reset(new commands::NaviStartStreamResponse(
+ message, application_manager));
} else {
- command.reset(new commands::NaviStartStreamRequest(message));
+ command.reset(
+ new commands::NaviStartStreamRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_StopStream: {
if (is_response) {
- command.reset(new commands::NaviStopStreamResponse(message));
+ command.reset(
+ new commands::NaviStopStreamResponse(message, application_manager));
} else {
- command.reset(new commands::NaviStopStreamRequest(message));
+ command.reset(
+ new commands::NaviStopStreamRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_StartAudioStream: {
if (is_response) {
- command.reset(new commands::AudioStartStreamResponse(message));
+ command.reset(new commands::AudioStartStreamResponse(
+ message, application_manager));
} else {
- command.reset(new commands::AudioStartStreamRequest(message));
+ command.reset(new commands::AudioStartStreamRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_StopAudioStream: {
if (is_response) {
- command.reset(new commands::AudioStopStreamResponse(message));
+ command.reset(new commands::AudioStopStreamResponse(
+ message, application_manager));
} else {
- command.reset(new commands::AudioStopStreamRequest(message));
+ command.reset(
+ new commands::AudioStopStreamRequest(message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_OnAudioDataStreaming: {
- command.reset(new commands::OnAudioDataStreamingNotification(message));
+ command.reset(new commands::OnAudioDataStreamingNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::Navigation_OnVideoDataStreaming: {
- command.reset(new commands::OnVideoDataStreamingNotification(message));
+ command.reset(new commands::OnVideoDataStreamingNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
if (is_response) {
- command.reset(new commands::VRPerformInteractionResponse(message));
+ command.reset(new commands::VRPerformInteractionResponse(
+ message, application_manager));
} else {
- command.reset(new commands::VRPerformInteractionRequest(message));
+ command.reset(new commands::VRPerformInteractionRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnSystemRequest: {
- command.reset(new commands::OnSystemRequestNotification(message));
+ command.reset(new commands::OnSystemRequestNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnPutFile: {
- command.reset(new commands::OnPutFileNotification(message));
+ command.reset(
+ new commands::OnPutFileNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource: {
- command.reset(new commands::OnResumeAudioSourceNotification(message));
+ command.reset(new commands::OnResumeAudioSourceNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_SetDisplayLayout: {
if (is_response) {
- command.reset(new commands::UiSetDisplayLayoutResponse(message));
+ command.reset(new commands::UiSetDisplayLayoutResponse(
+ message, application_manager));
} else {
- command.reset(new commands::UiSetDisplayLayoutRequest(message));
+ command.reset(new commands::UiSetDisplayLayoutRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnSDLClose: {
- command.reset(new commands::OnSDLCloseNotification(message));
+ command.reset(
+ new commands::OnSDLCloseNotification(message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete: {
- command.reset(new commands::OnSDLPersistenceCompleteNotification(message));
+ command.reset(new commands::OnSDLPersistenceCompleteNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnFileRemoved: {
- command.reset(new commands::OnFileRemovedNotification(message));
+ command.reset(new commands::OnFileRemovedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::UI_OnRecordStart: {
- command.reset(new commands::OnRecordStartdNotification(message));
+ command.reset(new commands::OnRecordStartdNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_SystemRequest: {
if (is_response) {
- command.reset(new commands::BasicCommunicationSystemResponse(message));
+ command.reset(new commands::BasicCommunicationSystemResponse(
+ message, application_manager));
} else {
- command.reset(new commands::BasicCommunicationSystemRequest(message));
+ command.reset(new commands::BasicCommunicationSystemRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::Navigation_SendLocation: {
if (is_response) {
- command.reset(new commands::NaviSendLocationResponse(message));
+ command.reset(new commands::NaviSendLocationResponse(
+ message, application_manager));
} else {
- command.reset(new commands::NaviSendLocationRequest(message));
+ command.reset(new commands::NaviSendLocationRequest(
+ message, application_manager));
}
break;
}
case hmi_apis::FunctionID::SDL_AddStatisticsInfo: {
- command.reset(new commands::AddStatisticsInfoNotification(message));
+ command.reset(new commands::AddStatisticsInfoNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnSystemError: {
- command.reset(new commands::OnSystemErrorNotification(message));
+ command.reset(new commands::OnSystemErrorNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnReceivedPolicyUpdate: {
- command.reset(new commands::OnReceivedPolicyUpdate(message));
+ command.reset(
+ new commands::OnReceivedPolicyUpdate(message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnPolicyUpdate: {
- command.reset(new commands::OnPolicyUpdate(message));
+ command.reset(new commands::OnPolicyUpdate(message, application_manager));
break;
}
case hmi_apis::FunctionID::SDL_OnDeviceStateChanged: {
- command.reset(new commands::OnDeviceStateChangedNotification(message));
+ command.reset(new commands::OnDeviceStateChangedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- command.reset(new commands::hmi::OnTTSResetTimeoutNotification(message));
+ command.reset(new commands::hmi::OnTTSResetTimeoutNotification(
+ message, application_manager));
break;
}
- case hmi_apis::FunctionID::BasicCommunication_OnPhoneCall: {
- command.reset(new commands::hmi::OnPhoneCallNotification(message));
+ case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: {
+ command.reset(new commands::OnEventChangedNotification(
+ message, application_manager));
break;
}
case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
if (is_response) {
- command.reset(new commands::hmi::DialNumberResponse(message));
+ command.reset(new commands::hmi::DialNumberResponse(
+ message, application_manager));
} else {
- command.reset(new commands::hmi::DialNumberRequest(message));
+ command.reset(
+ new commands::hmi::DialNumberRequest(message, application_manager));
}
break;
}
+ case hmi_apis::FunctionID::Navigation_OnWayPointChange: {
+ command.reset(new commands::OnNaviWayPointChangeNotification(
+ message, application_manager));
+ break;
+ }
}
-
return command;
}
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..d37467ee76
--- /dev/null
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -0,0 +1,352 @@
+/*
+ * 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.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(ApplicationManager& application_manager)
+ : event_engine::EventObserver(application_manager.event_dispatcher())
+ , 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)
+ , application_manager_(application_manager) {
+ 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);
+ last_state_->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 (last_state_->dictionary.isMember(LanguagesKey)) {
+ if (last_state_->dictionary[LanguagesKey].isMember(key)) {
+ Common_Language::eType language = static_cast<Common_Language::eType>(
+ last_state_->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:
+ if (!(msg[strings::params].keyExists(strings::app_id))) {
+ LOG4CXX_ERROR(logger_, "Message doesn't contain parameter app_id");
+ return;
+ }
+ 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 = application_manager_.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 (application_manager_.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 =
+ application_manager_.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.");
+
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ 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. HMILanguageHandler unsubscribed "
+ "from all events.");
+ unsubscribe_from_all_events();
+ }
+}
+
+void HMILanguageHandler::HandleWrongLanguageApp(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_DEBUG(logger_,
+ "Application id "
+ << app.first
+ << " is not found within apps with wrong language.");
+ return;
+ }
+ apps_.erase(it);
+ if (0 == apps_.size()) {
+ LOG4CXX_DEBUG(logger_,
+ "HMILanguageHandler unsubscribed from all events.");
+ unsubscribe_from_all_events();
+ }
+ }
+ SendOnLanguageChangeToMobile(app.first);
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app.first,
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(
+ app.first, mobile_apis::Result::SUCCESS, false);
+ LOG4CXX_INFO(logger_,
+ "Unregistering application with app_id "
+ << app.first << " because of HMI language(s) mismatch.");
+}
+
+void HMILanguageHandler::CheckApplication(const Apps::value_type app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool is_need_handle_wrong_language = false;
+ {
+ 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;
+ }
+ is_need_handle_wrong_language = apps_[app.first];
+ }
+ if (is_need_handle_wrong_language) {
+ HandleWrongLanguageApp(app);
+ }
+}
+
+void HMILanguageHandler::Init(resumption::LastState* value) {
+ last_state_ = value;
+ persisted_ui_language_ = get_language_for(INTERFACE_UI);
+ persisted_vr_language_ = get_language_for(INTERFACE_VR);
+ persisted_tts_language_ = get_language_for(INTERFACE_TTS);
+}
+
+void HMILanguageHandler::OnUnregisterApplication(uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(apps_lock_);
+ apps_.erase(app_id);
+}
+
+} // 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..80628f9f33 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -1,65 +1,109 @@
+/*
+ * 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,
+ const 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, const 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 {
+ const ApplicationSharedPtr app = app_mngr_.application(app_id);
+ 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 {
+ const ApplicationSharedPtr app = app_mngr_.application(app_id);
+ 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 {
+ const ApplicationSharedPtr app = app_mngr_.application(app_id);
+ 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, const 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, const 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,
+ const ApplicationManager& app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_NAVI_STREAMING) {}
mobile_apis::AudioStreamingState::eType
NaviStreamingHmiState::audio_streaming_state() const {
@@ -67,9 +111,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 +121,80 @@ 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,
+ const 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,
+ const ApplicationManager& app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {}
+
+DeactivateHMI::DeactivateHMI(uint32_t app_id,
+ const 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, const 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, const 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.cc b/src/components/application_manager/src/message.cc
index 2e4920d262..1dbac42010 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -56,16 +56,15 @@ MessageType MessageTypeFromRpcType(protocol_handler::RpcType rpc_type) {
}
Message::Message(protocol_handler::MessagePriority priority)
- : function_id_(0),
- correlation_id_(0),
- type_(kUnknownType),
- priority_(priority),
- connection_key_(0),
- binary_data_(NULL),
- data_size_(0),
- payload_size_(0),
- version_(kUnknownProtocol) {
-}
+ : function_id_(0)
+ , correlation_id_(0)
+ , type_(kUnknownType)
+ , priority_(priority)
+ , connection_key_(0)
+ , binary_data_(NULL)
+ , data_size_(0)
+ , payload_size_(0)
+ , version_(kUnknownProtocol) {}
Message::Message(const Message& message)
: priority_(message.priority_),
@@ -100,13 +99,13 @@ bool Message::operator==(const Message& message) {
bool data_size = data_size_ == message.data_size_;
bool payload_size = payload_size_ == message.payload_size_;
-
- bool binary_data = std::equal(binary_data_->begin(), binary_data_->end(),
+ bool binary_data = std::equal(binary_data_->begin(),
+ binary_data_->end(),
message.binary_data_->begin(),
BinaryDataPredicate);
- return function_id && correlation_id && connection_key && type && binary_data
- && json_message && version && data_size && payload_size;
+ return function_id && correlation_id && connection_key && type &&
+ binary_data && json_message && version && data_size && payload_size;
}
Message::~Message() {
@@ -192,7 +191,7 @@ void Message::set_protocol_version(ProtocolVersion version) {
version_ = version;
}
-const smart_objects::SmartObject &Message::smart_object() const {
+const smart_objects::SmartObject& Message::smart_object() const {
return smart_object_;
}
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
deleted file mode 100644
index fd42305f77..0000000000
--- a/src/components/application_manager/src/message_helper.cc
+++ /dev/null
@@ -1,2620 +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/message_helper.h"
-
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-#undef __STDC_FORMAT_MACROS
-
-#include <set>
-#include <string>
-#include <algorithm>
-#include <utility>
-#include <map>
-
-#include "application_manager/application.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/commands/command_impl.h"
-#include "application_manager/policies/policy_handler.h"
-#include "config_profile/profile.h"
-#include "connection_handler/connection_handler_impl.h"
-#include "interfaces/MOBILE_API.h"
-#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 {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-
-namespace {
-
-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);
-}
-
-bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) {
- using namespace smart_objects;
- for (size_t i = 0; i < soft_buttons.length(); ++i) {
- SmartObject& button = soft_buttons[i];
-
- // Check if image parameter is valid
- if (button.keyExists(strings::image)) {
- SmartObject& buttonImage = button[strings::image];
-
- // Image name must not be empty and must not contain incorrect
- //character
- if (false == MessageHelper::VerifySoftButtonString(
- 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),
-};
-
-const VehicleData MessageHelper::vehicle_data_(
- kVehicleDataInitializer, kVehicleDataInitializer +
- ARRAYSIZE(kVehicleDataInitializer));
-
-#ifdef HMI_DBUS_API
-namespace {
-struct VehicleInfo_Requests {
- hmi_apis::FunctionID::eType func_id;
- 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},
-};
-}
-#endif // #ifdef HMI_DBUS_API
-
-std::string MessageHelper::CommonLanguageToString(
- hmi_apis::Common_Language::eType language) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
- const char* str = 0;
- if (EnumConversionHelper<hmi_apis::Common_Language::eType>::EnumToCString(
- language, &str)) {
- return str ? str : "";
- }
- return std::string();
-}
-
-hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
- const std::string& language) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
- hmi_apis::Common_Language::eType value;
- if (EnumConversionHelper<hmi_apis::Common_Language::eType>::StringToEnum(
- 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) {
- 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;
- }
- }
-
- 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());
- }
- 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));
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::GetHashUpdateNotification(
- const uint32_t app_id) {
-
- LOG4CXX_INFO(logger_, "GetHashUpdateNotification" << 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);
- (*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);
- 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;
- (*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::msg_params][strings::url] = policy::PolicyHandler::instance()->GetLockScreenIconUrl();
-
-
- return message;
-}
-
-void MessageHelper::SendLockScreenIconUrlNotification(const uint32_t connection_key) {
- LOG4CXX_INFO(logger_, "SendLockScreenIconUrlNotification");
-
- smart_objects::SmartObject* so = GetLockScreenIconUrlNotification(connection_key);
- PrintSmartObject(*so);
- DCHECK(ApplicationManagerImpl::instance()->ManageMobileCommand(so));
-}
-
-void MessageHelper::SendHashUpdateNotification(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- smart_objects::SmartObjectSPtr so = GetHashUpdateNotification(app_id);
- if (so) {
- PrintSmartObject(*so);
- if (!ApplicationManagerImpl::instance()->ManageMobileCommand(so)) {
- LOG4CXX_ERROR_EXT(logger_, "Failed to send HashUpdate notification.");
- } else {
- ApplicationManagerImpl::instance()->resume_controller().ApplicationsDataUpdated();
- }
- }
-}
-
-void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- 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::message_type] =
- static_cast<int32_t>(kNotification);
-
- message[strings::params][strings::connection_key] = connection_key;
-
- message[strings::msg_params][strings::reason] = static_cast<int32_t>(reason);
-
- if (ApplicationManagerImpl::instance()->ManageMobileCommand(notification)) {
- LOG4CXX_DEBUG(logger_, "Mobile command sent");
- }
- else {
- LOG4CXX_WARN(logger_, "Cannot send mobile command");
- }
-}
-
-const VehicleData& MessageHelper::vehicle_data() {
- return vehicle_data_;
-}
-
-mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel(
- const std::string& hmi_level) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
- mobile_apis::HMILevel::eType value;
- if (EnumConversionHelper<mobile_apis::HMILevel::eType>::StringToEnum(
- hmi_level, &value)) {
- return value;
- }
- return mobile_apis::HMILevel::INVALID_ENUM;
-}
-
-std::string MessageHelper::StringifiedHMILevel(
- mobile_apis::HMILevel::eType hmi_level) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
- const char* str = 0;
- if (EnumConversionHelper<mobile_apis::HMILevel::eType>::EnumToCString(
- hmi_level, &str)) {
- return str;
- }
- return std::string();
-}
-
-std::string MessageHelper::StringifiedFunctionID(
- 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)) {
- 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");
- return enum_name.substr(0, enum_name.length() - 2);
- }
- return std::string();
-}
-
-#ifdef HMI_DBUS_API
-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));
- return rc;
-}
-static std::map<std::string, uint16_t> vehicle_data_args = create_get_vehicle_data_args();
-}
-#endif
-
-void MessageHelper::CreateGetVehicleDataRequest(
- uint32_t correlation_id, const std::vector<std::string>& params) {
- LOG4CXX_AUTO_TRACE(logger_);
-#ifdef HMI_DBUS_API
- for (std::vector<std::string>::const_iterator it = params.begin();
- 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::correlation_id] = correlation_id;
- (*request)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*request)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*request)[strings::params][strings::function_id] =
- 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::function_id] =
- 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_;
- (*request)[strings::params][strings::protocol_type] =
- 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++) {
- (*request)[strings::msg_params][*it] = true;
- }
- ApplicationManagerImpl::instance()->ManageHMICommand(request);
-#endif
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
- mobile_apis::FunctionID::eType function_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);
- (*response)[strings::params][strings::message_type] =
- static_cast<int>(kResponse);
- (*response)[strings::msg_params][strings::success] = false;
- (*response)[strings::msg_params][strings::result_code] =
- 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_;
- (*response)[strings::params][strings::protocol_version] =
- static_cast<int>(kV2);
- return response;
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
- 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);
- 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) {
- const connection_handler::Device& d =
- 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());
- list_so[index][strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
- list_so[index][strings::transport_type] =
- ApplicationManagerImpl::instance()->GetDeviceTransportType(d.connection_type());
- ++index;
- }
- return device_list_so;
-}
-
-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::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);
- return module_info;
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
- 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);
-
- if (!set_icon) {
- return NULL;
- }
-
- smart_objects::SmartObject& object = *set_icon;
- 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);
- object[strings::app_id] = app_id;
-
- return set_icon;
-}
-
-bool MessageHelper::SendIVISubscribtions(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- bool result = true;
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- app_id);
-
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application " << app_id);
- return result;
- }
-
- smart_objects::SmartObjectList requests = GetIVISubscriptionRequests(app);
- for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
- it != requests.end(); ++it) {
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(*it)) {
- result = false;
- }
- }
- return result;
-}
-
-smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
- ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- smart_objects::SmartObjectList hmi_requests;
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application pointer ");
- return hmi_requests;
- }
-
- 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();
-
- 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)) {
- std::string key_name = ivi_it->first;
- msg_params[key_name] = true;
- }
- }
-
-#ifdef HMI_JSON_API
- smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
- (*request)[strings::msg_params] = msg_params;
- hmi_requests.push_back(request);
-#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) {
- 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);
- (*request)[strings::msg_params] = msg_params;
- hmi_requests.push_back(request);
- }
- }
-#endif // #ifdef HMI_DBUS_API
- return hmi_requests;
-}
-
-void MessageHelper::SendOnButtonSubscriptionNotification(
- uint32_t app_id, hmi_apis::Common_ButtonName::eType button, bool is_subscribed) {
- using namespace smart_objects;
- using namespace hmi_apis;
- LOG4CXX_AUTO_TRACE(logger_);
-
- SmartObjectSPtr notification_ptr = utils::MakeShared<SmartObject>(SmartType_Map);
- if (!notification_ptr) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
- return;
- }
- SmartObject& notification = *notification_ptr;
-
- SmartObject msg_params = SmartObject(SmartType_Map);
- msg_params[strings::app_id] = app_id;
- msg_params[strings::name] = button;
- msg_params[strings::is_suscribed] = is_subscribed;
-
- notification[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- notification[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- notification[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- notification[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Buttons_OnButtonSubscription;
- notification[strings::msg_params] = msg_params;
-
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(notification_ptr)) {
- LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
- }
-}
-
-void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app) {
- using namespace smart_objects;
- using namespace hmi_apis;
- using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application pointer ");
- return;
- }
-
- std::set<ButtonName::eType> subscriptions = app->SubscribedButtons();
- std::set<ButtonName::eType>::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,
- const std::string& icon_path) {
- using namespace smart_objects;
- SmartObjectSPtr set_app_icon(new smart_objects::SmartObject);
- 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();
-
- 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;
- }
- ApplicationManagerImpl::instance()->ManageHMICommand(set_app_icon);
- }
-}
-
-void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (app) {
- SendSetAppIcon(app, app->app_icon_path());
- SendGlobalPropertiesToHMI(app);
- SendShowRequestToHMI(app);
- }
-}
-
-void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app) {
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application");
- return;
- }
-
- smart_objects::SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(app);
- for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
- it != requests.end(); ++it) {
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it))
- }
-}
-
-smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI(
- ApplicationConstSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- smart_objects::SmartObjectList requests;
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application");
- return requests;
- }
-
- // 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);
-
- 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();
-
- smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- if (app->vr_help_title()) {
- ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
- }
- if (app->vr_help()) {
- ui_msg_params[strings::vr_help] = (*app->vr_help());
- }
- if (app->keyboard_props()) {
- ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
- }
- if (app->menu_title()) {
- ui_msg_params[strings::menu_title] = (*app->menu_title());
- }
- if (app->menu_icon()) {
- ui_msg_params[strings::menu_icon] = (*app->menu_icon());
- }
- ui_msg_params[strings::app_id] = app->app_id();
-
- (*ui_global_properties)[strings::msg_params] = ui_msg_params;
-
- requests.push_back(ui_global_properties);
- }
-
- // TTS global properties
- if (app->help_prompt() || app->timeout_prompt()) {
- smart_objects::SmartObjectSPtr tts_global_properties =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- 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();
-
- smart_objects::SmartObject tts_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- if (app->help_prompt()) {
- tts_msg_params[strings::help_prompt] = (*app->help_prompt());
- }
- if (app->timeout_prompt()) {
- tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
- }
- tts_msg_params[strings::app_id] = app->app_id();
-
- (*tts_global_properties)[strings::msg_params] = tts_msg_params;
-
- requests.push_back(tts_global_properties);
- }
- return requests;
-}
-
-void MessageHelper::SendTTSGlobalProperties(
- ApplicationSharedPtr app, bool default_help_prompt) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!app) {
- return;
- }
- smart_objects::SmartObjectSPtr tts_global_properties(
- new smart_objects::SmartObject);
- 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);
- if (default_help_prompt) {
- const DataAccessor<CommandsMap> accessor = app->commands_map();
- const CommandsMap& commands = accessor.GetData();
- CommandsMap::const_iterator it = commands.begin();
- 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();
- item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT;
- } else {
- continue;
- }
- msg_params[strings::help_prompt][index++] = item;
- }
- }
- app->set_help_prompt(msg_params[strings::help_prompt]);
- msg_params[strings::app_id] = app->app_id();
- so_to_send[strings::msg_params] = msg_params;
- ApplicationManagerImpl::instance()->ManageHMICommand(tts_global_properties);
- }
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
- ApplicationConstSharedPtr app) {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- if (!result) {
- return NULL;
- }
- smart_objects::SmartObject& vr_help = *result;
- vr_help[strings::vr_help_title] = app->name();
-
- int32_t index = 0;
- if (app->vr_synonyms()) {
- smart_objects::SmartObject item(smart_objects::SmartType_Map);
- item[strings::text] = (*(app->vr_synonyms())).getElement(0);
- item[strings::position] = index + 1;
- vr_help[strings::vr_help][index++] = item;
- }
-
- // copy all app VR commands
- const DataAccessor<CommandsMap> cmd_accessor = app->commands_map();
- const CommandsMap& commands = cmd_accessor.GetData();
- CommandsMap::const_iterator it = commands.begin();
-
- for (; commands.end() != it; ++it) {
- smart_objects::SmartObject item(smart_objects::SmartType_Map);
- item[strings::text] = (*it->second)[strings::vr_commands][0].asString();
- item[strings::position] = index + 1;
- vr_help[strings::vr_help][index++] = item;
- }
- return result;
-}
-
-smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
- ApplicationConstSharedPtr app) {
-
- smart_objects::SmartObjectList requests;
- if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid application");
- return requests;
- }
-
- if (app->show_command()) {
- smart_objects::SmartObjectSPtr ui_show = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- (*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();
- (*ui_show)[strings::msg_params] = (*app->show_command());
- requests.push_back(ui_show);
- }
- return requests;
-}
-
-void MessageHelper::SendShowRequestToHMI(ApplicationConstSharedPtr app) {
- if (!app) {
- return;
- }
- smart_objects::SmartObjectList shows = CreateShowRequestToHMI(app);
-
- for (smart_objects::SmartObjectList::const_iterator it = shows.begin();
- it != shows.end(); ++it) {
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
- }
-
-}
-
-void MessageHelper::SendShowConstantTBTRequestToHMI(
- 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);
- 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();
- (*navi_show_tbt)[strings::msg_params] = (*app->tbt_show_command());
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(navi_show_tbt));
- }
-}
-
-void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app) {
- if (!app) {
- return;
- }
- smart_objects::SmartObjectList requests = CreateAddCommandRequestToHMI(app);
- for (smart_objects::SmartObjectList::iterator it = requests.begin(); it != requests.end();
- ++it) {
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
- }
-}
-
-smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
- ApplicationConstSharedPtr app) {
-
- smart_objects::SmartObjectList requests;
- if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid application");
- return requests;
- }
-
- const DataAccessor<CommandsMap> accessor = app->commands_map();
- const CommandsMap& commands = accessor.GetData();
- CommandsMap::const_iterator i = commands.begin();
- 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);
-
- 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();
-
- 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())) {
- 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();
- }
- (*ui_command)[strings::msg_params] = msg_params;
- requests.push_back(ui_command);
- }
-
- // VR Interface
- if ((*i->second).keyExists(strings::vr_commands)) {
- SendAddVRCommandToHMI(i->first, (*i->second)[strings::vr_commands],
- app->app_id());
- }
- }
- return requests;
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration(
- int32_t function_id, int32_t language, uint32_t app_id,
- const smart_objects::SmartObject* app_types) {
- smart_objects::SmartObjectSPtr command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- 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);
- msg_params[strings::language] = language;
- msg_params[strings::app_id] = app_id;
-
- if (app_types != NULL) {
- msg_params[strings::app_hmi_type] = *app_types;
- }
-
- params[strings::msg_params] = msg_params;
- return command;
-}
-
-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());
-
- if (ui_command) {
- ApplicationManagerImpl::instance()->ManageHMICommand(ui_command);
- }
- }
-}
-
-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());
-
- if (vr_command) {
- ApplicationManagerImpl::instance()->ManageHMICommand(vr_command);
- }
- }
-
- if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObjectSPtr tts_command = CreateChangeRegistration(
- hmi_apis::FunctionID::TTS_ChangeRegistration, app->language(),
- app->app_id());
-
- if (tts_command) {
- ApplicationManagerImpl::instance()->ManageHMICommand(tts_command);
- }
- }
-
- 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());
-
- 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);
- 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);
-
- 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);
- if (0 != cmd_id) {
- msg_params[strings::cmd_id] = cmd_id;
- }
- msg_params[strings::vr_commands] = vr_commands;
- if (0 < app_id) {
- msg_params[strings::app_id] = app_id;
- }
- msg_params[strings::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;
-
- return vr_command;
-}
-
-bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
- smart_objects::SmartObject& output) {
- using namespace smart_objects;
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!app) {
- LOG4CXX_WARN(logger_, "Application is not valid");
- return false;
- }
-
- 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 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());
- }
-
- 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();
-
- 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());
- }
- }
-
- if (ngn_media_screen_name) {
- output[strings::ngn_media_screen_app_name] = ngn_media_screen_name->asString();
- }
- if (app_types) {
- output[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;
- const policy::DeviceConsent device_consent =
- policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
- output[strings::device_info][strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
-
- output[strings::device_info][strings::transport_type] =
- ApplicationManagerImpl::instance()->GetDeviceTransportType(transport_type);
- return true;
-}
-
-void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app) {
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid application");
- return;
- }
-
- smart_objects::SmartObjectList requests = CreateAddSubMenuRequestToHMI(app);
- for (smart_objects::SmartObjectList::iterator it = requests.begin();
- it != requests.end(); ++it) {
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
- }
-}
-
-smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
- 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);
-
- 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();
-
- 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];
- msg_params[strings::menu_params][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);
- }
- return requsets;
-}
-
-void MessageHelper::SendOnAppUnregNotificationToHMI(
- ApplicationConstSharedPtr app, 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;
-
- 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
- message[strings::msg_params][strings::app_id] = app->hmi_app_id();
- message[strings::msg_params][strings::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;
- }
-
- correlation_id =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- utils::SharedPtr<smart_objects::SmartObject> message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- (*message)[strings::params][strings::function_id] =
- 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;
-
- if (send_policy_priority) {
- std::string priority;
- // TODO(KKolodiy): need remove method policy_manager
-
- 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);
-
- policy::DeviceConsent consent =
- policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_adress);
- if (!priority.empty() && (policy::DeviceConsent::kDeviceAllowed == consent)) {
- (*message)[strings::msg_params][strings::priority] = GetPriorityCode(priority);
- }
- }
-
- // We haven't send HMI level to HMI in case it FULL.
- if (hmi_apis::Common_HMILevel::INVALID_ENUM != level &&
- hmi_apis::Common_HMILevel::FULL != level) {
- (*message)[strings::msg_params][strings::activate_app_hmi_level] = level;
- }
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
- return correlation_id;
-}
-
-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);
- 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);
-
- (*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource;
- (*message)[strings::params][strings::message_type] = MessageType::kNotification;
- (*message)[strings::params][strings::correlation_id] =
- 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);
- if (!message) {
- return;
- }
-
- (*message)[strings::params][strings::function_id] =
- 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_;
- (*message)[strings::params][strings::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]["isAppRevoked"] = permissions.appRevoked;
- (*message)[strings::msg_params]["isAppPermissionsRevoked"] = permissions
- .isAppPermissionsRevoked;
-
- if (permissions.isAppPermissionsRevoked) {
- FillAppRevokedPermissions(permissions, *message);
- }
-
- (*message)[strings::msg_params]["isPermissionsConsentNeeded"] = permissions
- .appPermissionsConsentNeeded;
-
- if (!permissions.priority.empty()) {
- (*message)[strings::msg_params]["priority"] = GetPriorityCode(
- permissions.priority);
- }
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-
- // If application is revoked it should not be activated
- if (permissions.appRevoked || !permissions.isSDLAllowed) {
- return;
- }
-}
-
-void MessageHelper::SendOnSDLConsentNeeded(
- 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;
- (*message)[strings::params][strings::message_type] =
- MessageType::kNotification;
-
- (*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);
- 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_;
-
- 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);
- for (size_t i = 0; i < retries.size(); ++i) {
- object[strings::msg_params][hmi_request::retry][i] = retries[i];
- }
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-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);
- if (!message) {
- return;
- }
-
- (*message)[strings::params][strings::function_id] =
- 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);
- }
-
- const std::string messages = "messages";
- (*message)[strings::msg_params][messages] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- smart_objects::SmartObject& user_friendly_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);
-
- smart_objects::SmartObject& obj = user_friendly_messages[index];
- obj[message_code] = it->message_code;
- }
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-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);
- if (!message) {
- return;
- }
-
- (*message)[strings::params][strings::function_id] =
- 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& allowed_functions_array =
- (*message)[strings::msg_params][allowed_functions];
-
- std::vector<policy::FunctionalGroupPermission>::const_iterator it =
- permissions.begin();
- std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
- permissions.end();
- for (uint32_t index = 0; it != it_end; ++it, ++index) {
- 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;
- item[strings::id] = (*it).group_id;
- policy::GroupConsent permission_state = (*it).state;
- // If state undefined, 'allowed' parameter should be absent
- if (policy::kGroupUndefined != permission_state) {
- item["allowed"] = policy::kGroupAllowed == permission_state;
- }
- }
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
- 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::SmartObject& response_data = *response;
- response_data[strings::params][strings::function_id] = function_id;
- response_data[strings::params][strings::message_type] =
- 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_;
- response_data[strings::params][strings::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;
-
- return response;
-}
-
-void MessageHelper::SendNaviStartStream(int32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr start_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- 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);
-
- char url[100] = {'\0'};
- if ("socket" == profile::Profile::instance()->video_server_type()) {
- 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",
- 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());
- DCHECK(snprintf_result);
- }
- msg_params[strings::app_id] = app_id;
- msg_params[strings::url] = url;
-
- (*start_stream)[strings::msg_params] = msg_params;
-
- 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);
-
- 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);
-
- msg_params[strings::app_id] = app_id;
-
- (*stop_stream)[strings::msg_params] = msg_params;
-
- 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);
-
- 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);
-
- 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());
- } else if ("pipe" == profile::Profile::instance()->audio_server_type()) {
- 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());
- DCHECK(snprintf_result);
- }
-
- msg_params[strings::app_id] = app_id;
- msg_params[strings::url] = url;
-
- (*start_stream)[strings::msg_params] = msg_params;
-
- 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);
-
- 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);
-
- msg_params[strings::app_id] = app_id;
-
- (*stop_stream)[strings::msg_params] = msg_params;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(stop_stream);
-}
-
-void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
- bool available) {
- using namespace protocol_handler;
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- if (!notification) {
- return;
- }
-
- if (ServiceType::kAudio != service && ServiceType::kMobileNav != service) {
- return;
- }
-
- (*notification)[strings::params][strings::function_id] =
- ServiceType::kAudio == service
- ? hmi_apis::FunctionID::Navigation_OnAudioDataStreaming
- : hmi_apis::FunctionID::Navigation_OnVideoDataStreaming;
- (*notification)[strings::params][strings::message_type] =
- hmi_apis::messageType::notification;
- (*notification)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*notification)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
-
- (*notification)[strings::msg_params]["available"] = available;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(notification);
-}
-
-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::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_;
- 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) {
-
- using namespace mobile_apis;
- using namespace smart_objects;
-
- SmartObject content (SmartType_Map);
- if (!url.empty()) {
- content[strings::msg_params][strings::url] = url;
- }
-
- 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;
-
- SendSystemRequestNotification(connection_key, content);
-}
-
-void MessageHelper::SendSystemRequestNotification (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] = 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;
-
- ApplicationManagerImpl::instance()->ManageMobileCommand(new SmartObject(content));
-}
-
-void MessageHelper::SendLaunchApp(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;
- if (!urlSchema.empty()) {
- content[strings::msg_params][strings::url] = urlSchema;
- } else if (!packageName.empty()) {
- content[strings::msg_params][strings::url] = packageName;
- }
-
- SendSystemRequestNotification(connection_key, content);
-}
-
-void application_manager::MessageHelper::SendQueryApps(
- 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] =
- policy_handler->TimeoutExchange();
-
- Json::Value http;
- Json::Value& http_header = http[http_request::httpRequest][http_request::headers];
-
- const int timeout = policy_handler->TimeoutExchange();
-
- http_header[http_request::content_type] = "application/json";
- http_header[http_request::connect_timeout] = timeout;
- http_header[http_request::do_output] = true;
- http_header[http_request::do_input] = true;
- http_header[http_request::use_caches] = false;
- http_header[http_request::request_method] = http_request::GET;
- http_header[http_request::read_timeout] = timeout;
- http_header[http_request::instance_follow_redirect] = false;
- http_header[http_request::charset] = "utf-8";
- http_header[http_request::content_lenght] = 0;
-
- 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;
-
- 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);
- smart_objects::SmartObject& content = *notification;
-
- content[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnPermissionsChangeID;
- 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::connection_key] = connection_key;
-
- 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]["permissionItem"] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
-
- smart_objects::SmartObject& permissions_item_array =
- 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);
-
- smart_objects::SmartObject& permission_item =
- 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);
-
- smart_objects::SmartObject& hmi_permissions =
- permission_item["hmiPermissions"];
-
- 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();
-
- // 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);
-
- smart_objects::SmartObject& hmi_levels =
- hmi_permissions[(*it_hmi_permissions).first];
-
- std::set<policy::HMILevel>::const_iterator it_hmi_levels =
- (*it_hmi_permissions).second.begin();
- std::set<policy::HMILevel>::const_iterator it_hmi_levels_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) {
- hmi_levels[index_hmi_levels] = *it_hmi_levels;
- }
- }
-
- // Creating SO for parameterPermissions
- permission_item["parameterPermissions"] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- smart_objects::SmartObject& parameter_permissions =
- permission_item["parameterPermissions"];
-
- policy::ParameterPermissions::const_iterator it_parameter_permissions =
- rpc_permissions.parameter_permissions.begin();
- policy::ParameterPermissions::const_iterator it_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& parameters =
- parameter_permissions[(*it_parameter_permissions).first];
-
- std::set<policy::Parameter>::const_iterator it_parameters =
- (*it_parameter_permissions).second.begin();
- std::set<policy::Parameter>::const_iterator it_parameters_end =
- (*it_parameter_permissions).second.end();
-
- for (size_t index_parameters = 0; it_parameters != it_parameters_end;
- ++it_parameters, ++index_parameters) {
- parameters[index_parameters] = *it_parameters;
- }
- }
- }
-
- ApplicationManagerImpl::instance()->ManageMobileCommand(notification);
-}
-
-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& 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);
- smart_objects::SmartObject& permission_item = revoked_permission_items[i];
- permission_item["name"] = permissions.appRevokedPermissions[i].
- group_alias;
-
- permission_item["id"] = permissions.appRevokedPermissions[i].group_id;
-
- if (policy::kGroupUndefined !=
- permissions.appRevokedPermissions[i].state) {
- permission_item["allowed"] =
- policy::kGroupAllowed == permissions.appRevokedPermissions[i].state
- ? true : false;
- }
- }
-}
-
-void MessageHelper::SendOnAppPermissionsChangedNotification(
- uint32_t connection_key, const policy::AppPermissions& permissions) {
- using namespace smart_objects;
- SmartObjectSPtr notification = new SmartObject(SmartType_Map);
- if (!notification) {
- return;
- }
-
- SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_OnAppPermissionChanged;
-
- message[strings::params][strings::message_type] = MessageType::kNotification;
- message[strings::msg_params][strings::app_id] = connection_key;
-
- // TODO(AOleynik): Add other parameters processing from incoming struct
- if (permissions.appRevoked) {
- message[strings::msg_params]["appRevoked"] = permissions.appRevoked;
- }
- if (permissions.isAppPermissionsRevoked) {
- message[strings::msg_params]["isAppPermissionsRevoked"] = permissions
- .isAppPermissionsRevoked;
-
- FillAppRevokedPermissions(permissions, message);
- }
-
- if (permissions.appPermissionsConsentNeeded) {
- message[strings::msg_params]["appPermissionsConsentNeeded"] = permissions
- .appPermissionsConsentNeeded;
- }
- if (permissions.appUnauthorized) {
- message[strings::msg_params]["appUnauthorized"] = permissions
- .appUnauthorized;
- }
- if (!permissions.priority.empty()) {
- 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;
- }
-
- 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);
- if (!message) {
- return;
- }
-
- (*message)[strings::params][strings::function_id] =
- 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;
-
- (*message)[strings::msg_params]["status"] = status;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-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;
- }
-
- (*message)[strings::params][strings::function_id] =
- 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;
-
- (*message)[strings::msg_params]["result"] = result;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-void MessageHelper::SendOnStatusUpdate(const std::string& status) {
- 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;
- (*message)[strings::params][strings::message_type] =
- MessageType::kNotification;
-
- (*message)[strings::msg_params]["status"] = status;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-void MessageHelper::SendGetSystemInfoRequest() {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- 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_;
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
-}
-
-mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
- 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);
- if (mobile_apis::Result::SUCCESS != res) {
- LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
- return res;
- }
- }
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map
- == message.getType()) {
- if (message.keyExists(strings::image_type)) {
- mobile_apis::Result::eType verification_result = VerifyImage(message,
- app);
-
- if (mobile_apis::Result::SUCCESS != 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) {
- if (strings::soft_buttons != (*key)) {
- mobile_apis::Result::eType res = VerifyImageFiles(message[*key], app);
- if (mobile_apis::Result::SUCCESS != res) {
- LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
- return res;
- }
- }
- }
- }
- } // all other types shoudn't be processed
-
- return mobile_apis::Result::SUCCESS;
-}
-
-mobile_apis::Result::eType MessageHelper::VerifyImage(
- 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);
- if (mobile_apis::ImageType::STATIC == type) {
- return mobile_apis::Result::SUCCESS;
- }
-
- const std::string& file_name = image[strings::value].asString();
-
- std::string str = file_name;
- str.erase(remove(str.begin(), str.end(), ' '), str.end());
- if (0 == str.size()) {
- return mobile_apis::Result::INVALID_DATA;
- }
-
- std::string full_file_path;
- if (file_name.size() > 0 && file_name[0] == '/') {
- full_file_path = file_name;
- } else {
- const std::string& 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
- full_file_path = app_storage_folder + "/";
- }
- else { // relative path
- full_file_path = file_system::CurrentWorkingDirectory() + "/" +
- app_storage_folder + "/";
- }
- }
- else { // empty app storage folder
- full_file_path = file_system::CurrentWorkingDirectory() + "/";
- }
-
- full_file_path += app->folder_name();
- full_file_path += "/";
- full_file_path += file_name;
- }
-
- if (!file_system::FileExists(full_file_path)) {
- return mobile_apis::Result::INVALID_DATA;
- }
-
- image[strings::value] = full_file_path;
-
- return mobile_apis::Result::SUCCESS;
-}
-
-mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
- mobile_apis::Result::eType verification_result_image =
- 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);
- if (mobile_apis::Result::SUCCESS != verification_result_image) {
- return verification_result_image;
- }
- }
- }
- return mobile_apis::Result::SUCCESS;
-}
-
-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"
- "string contains incorrect character");
- return false;
- }
- return true;
-}
-
-bool MessageHelper::CheckWithPolicy(
- mobile_api::SystemAction::eType system_action,
- const std::string& app_mobile_id) {
- using namespace mobile_apis;
- bool result = true;
- policy::PolicyHandler* policy_handler = policy::PolicyHandler::instance();
- if (NULL != policy_handler && policy_handler->PolicyEnabled()) {
- result = policy_handler->CheckSystemAction(system_action, app_mobile_id);
- }
-
- return result;
-}
-
-mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
- smart_objects::SmartObject& message_params, ApplicationConstSharedPtr app) {
- using namespace mobile_apis;
- using namespace smart_objects;
-
- if (!message_params.keyExists(strings::soft_buttons)) {
- 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
- if (!ValidateSoftButtons(request_soft_buttons)) {
- return Result::INVALID_DATA;
- }
-
- SmartObject soft_buttons(SmartType_Array);
-
- 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();
-
- if (!CheckWithPolicy(static_cast<SystemAction::eType>(system_action),
- app->mobile_app_id())) {
- return Result::DISALLOWED;
- }
-
- 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.
- 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 {
- return Result::INVALID_DATA;
- }
- break;
- }
- case SoftButtonType::SBT_TEXT: {
- if ((!request_soft_buttons[i].keyExists(strings::text)) ||
- (!VerifySoftButtonString(
- request_soft_buttons[i][strings::text].asString()))) {
- return Result::INVALID_DATA;
- }
- 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())))) {
- 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;
-
- }
- }
- break;
- }
- default: {
- continue;
- break;
- }
- }
-
- soft_buttons[j] = request_soft_buttons[i];
- ++j;
- }
-
- request_soft_buttons = soft_buttons;
-
- if (0 == request_soft_buttons.length()) {
- message_params.erase(strings::soft_buttons);
- }
- return Result::SUCCESS;
-}
-
-void MessageHelper::SubscribeApplicationToSoftButton(
- smart_objects::SmartObject& message_params, ApplicationSharedPtr app,
- int32_t function_id) {
- SoftButtonID softbuttons_id;
- smart_objects::SmartObject& soft_buttons = message_params[strings::soft_buttons];
- unsigned int length = soft_buttons.length();
- for(unsigned int i = 0; i < length; ++i) {
- softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
- }
- app->SubscribeToSoftButtons(function_id, softbuttons_id);
-}
-
-// TODO(AK): change printf to logger
-bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
- return true;
-#ifdef ENABLE_LOG
- static uint32_t tab = 0;
- std::string tab_buffer;
-
- if (tab == 0) {
- printf("\n-------------------------------------------------------------");
- }
-
- for (uint32_t i = 0; i < tab; ++i) {
- tab_buffer += "\t";
- }
-
- switch (object.getType()) {
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Array: {
- for (size_t i = 0; i < object.length(); i++) {
- ++tab;
-
- printf("\n%s%zu: ", tab_buffer.c_str(), i);
- if (!PrintSmartObject(object.getElement(i))) {
- printf("\n");
- return false;
- }
- }
- break;
- }
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Map: {
- std::set<std::string> keys = object.enumerate();
-
- for (std::set<std::string>::const_iterator key = keys.begin();
- key != keys.end(); key++) {
- ++tab;
-
- printf("\n%s%s: ", tab_buffer.c_str(), (*key).c_str());
- if (!PrintSmartObject(object[(*key).c_str()])) {
- printf("\n");
- return false;
- }
- }
- break;
- }
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean:
- object.asBool() ? printf("true\n") : printf("false\n");
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Double: {
- printf("%f", object.asDouble());
- break;
- }
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Integer:
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_String:
- printf("%s", object.asString().c_str());
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Character:
- printf("%c", object.asChar());
- break;
- default:
- printf("PrintSmartObject - default case\n");
- break;
- }
-
- if (0 != tab) {
- --tab;
- } else {
- printf("\n-------------------------------------------------------------\n");
- }
-#endif
- return true;
-}
-
-} // namespace application_manager
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
new file mode 100644
index 0000000000..08efba3d70
--- /dev/null
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -0,0 +1,2501 @@
+/*
+ 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/message_helper.h"
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+#undef __STDC_FORMAT_MACROS
+
+#include <set>
+#include <string>
+#include <algorithm>
+#include <utility>
+#include <map>
+
+#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/file_system.h"
+#include "utils/macro.h"
+#include "utils/logger.h"
+#include "utils/make_shared.h"
+
+#include "formatters/formatter_json_rpc.h"
+#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;
+
+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}};
+
+bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) {
+ using namespace smart_objects;
+ for (size_t i = 0; i < soft_buttons.length(); ++i) {
+ SmartObject& button = soft_buttons[i];
+
+ // Check if image parameter is valid
+ if (button.keyExists(strings::image)) {
+ SmartObject& buttonImage = button[strings::image];
+
+ // Image name must not be empty and must not contain incorrect
+ // character
+ if (false == MessageHelper::VerifySoftButtonString(
+ 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),
+};
+
+const VehicleData MessageHelper::vehicle_data_(
+ kVehicleDataInitializer,
+ kVehicleDataInitializer + ARRAYSIZE(kVehicleDataInitializer));
+
+#ifdef HMI_DBUS_API
+namespace {
+struct VehicleInfo_Requests {
+ hmi_apis::FunctionID::eType func_id;
+ 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},
+};
+}
+#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) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ const char* str = 0;
+ if (EnumConversionHelper<hmi_apis::Common_Language::eType>::EnumToCString(
+ language, &str)) {
+ return str ? str : "";
+ }
+ return std::string();
+}
+
+hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
+ const std::string& language) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ hmi_apis::Common_Language::eType value;
+ if (EnumConversionHelper<hmi_apis::Common_Language::eType>::StringToEnum(
+ language, &value)) {
+ return value;
+ }
+ return hmi_apis::Common_Language::INVALID_ENUM;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateRequestObject(
+ const uint32_t correlation_id) {
+ using namespace smart_objects;
+
+ SmartObjectSPtr request = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObject& ref = *request;
+
+ 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] = correlation_id;
+ return request;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification(
+ const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<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;
+}
+
+void MessageHelper::SendHashUpdateNotification(const uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = app_mngr.application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application not found by appID");
+ return;
+ }
+ smart_objects::SmartObjectSPtr so = CreateHashUpdateNotification(app_id);
+ PrintSmartObject(*so);
+ if (!app_mngr.ManageMobileCommand(so, commands::Command::ORIGIN_SDL)) {
+ LOG4CXX_ERROR(logger_, "Failed to send HashUpdate notification.");
+ return;
+ }
+ app_mngr.resume_controller().ApplicationsDataUpdated();
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ int32_t connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ 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::OnAppInterfaceUnregisteredID);
+
+ message[strings::params][strings::message_type] =
+ static_cast<int32_t>(kNotification);
+
+ message[strings::params][strings::connection_key] = connection_key;
+
+ message[strings::msg_params][strings::reason] = static_cast<int32_t>(reason);
+
+ return notification;
+}
+
+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) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ mobile_apis::HMILevel::eType value;
+ if (EnumConversionHelper<mobile_apis::HMILevel::eType>::StringToEnum(
+ hmi_level, &value)) {
+ return value;
+ }
+ return mobile_apis::HMILevel::INVALID_ENUM;
+}
+
+std::string MessageHelper::StringifiedHMILevel(
+ mobile_apis::HMILevel::eType hmi_level) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ const char* str = 0;
+ if (EnumConversionHelper<mobile_apis::HMILevel::eType>::EnumToCString(
+ hmi_level, &str)) {
+ return str;
+ }
+ return std::string();
+}
+
+std::string MessageHelper::StringifiedFunctionID(
+ 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)) {
+ 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");
+ return enum_name.substr(0, enum_name.length() - 2);
+ }
+ return std::string();
+}
+
+#ifdef HMI_DBUS_API
+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));
+ return rc;
+}
+static std::map<std::string, uint16_t> vehicle_data_args =
+ create_get_vehicle_data_args();
+}
+#endif
+
+void MessageHelper::CreateGetVehicleDataRequest(
+ const uint32_t correlation_id,
+ const std::vector<std::string>& params,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+#ifdef HMI_DBUS_API
+ for (std::vector<std::string>::const_iterator it = params.begin();
+ it != params.end();
+ it++) {
+ smart_objects::SmartObjectSPtr request =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ (*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_;
+ (*request)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ (*request)[strings::params][strings::function_id] =
+ static_cast<int>(vehicle_data_args[*it]);
+ app_mngr.ManageHMICommand(request);
+ }
+#else
+
+ smart_objects::SmartObjectSPtr request =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ (*request)[strings::params][strings::message_type] =
+ static_cast<int>(kRequest);
+ (*request)[strings::params][strings::function_id] =
+ 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_;
+ (*request)[strings::params][strings::protocol_type] =
+ 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++) {
+ (*request)[strings::msg_params][*it] = true;
+ }
+ app_mngr.ManageHMICommand(request);
+#endif
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
+ mobile_apis::FunctionID::eType function_id,
+ mobile_apis::Result::eType result,
+ const uint32_t correlation_id,
+ uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ (*response)[strings::params][strings::function_id] =
+ static_cast<int>(function_id);
+ (*response)[strings::params][strings::message_type] =
+ static_cast<int>(kResponse);
+ (*response)[strings::msg_params][strings::success] = false;
+ (*response)[strings::msg_params][strings::result_code] =
+ 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_;
+ (*response)[strings::params][strings::protocol_version] =
+ static_cast<int>(kV2);
+ return response;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
+ const connection_handler::DeviceMap& devices,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr device_list_so =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*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) {
+ const connection_handler::Device& d =
+ 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_handler.GetUserConsentForDevice(it->second.mac_address());
+ list_so[index][strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+ list_so[index][strings::transport_type] =
+ app_mngr.GetDeviceTransportType(d.connection_type());
+ ++index;
+ }
+ return device_list_so;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
+ uint32_t function_id, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr module_info =
+ utils::MakeShared<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] =
+ app_mngr.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) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr set_icon =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ if (!set_icon) {
+ return NULL;
+ }
+
+ smart_objects::SmartObject& object = *set_icon;
+ 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);
+ object[strings::app_id] = app_id;
+
+ return set_icon;
+}
+
+bool MessageHelper::SendIVISubscribtions(const uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ bool result = true;
+ ApplicationSharedPtr app = app_mngr.application(app_id);
+
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application " << app_id);
+ return result;
+ }
+
+ smart_objects::SmartObjectList requests =
+ GetIVISubscriptionRequests(app, app_mngr);
+ for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
+ it != requests.end();
+ ++it) {
+ if (!app_mngr.ManageHMICommand(*it)) {
+ result = false;
+ }
+ }
+ return result;
+}
+
+smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
+ ApplicationSharedPtr app, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObjectList hmi_requests;
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer ");
+ return hmi_requests;
+ }
+
+ 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();
+ 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 (subscriptions.end() != subscriptions.find(type_id)) {
+ std::string key_name = ivi_it->first;
+ msg_params[key_name] = true;
+ }
+ }
+
+#ifdef HMI_JSON_API
+ smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, app_mngr);
+ (*request)[strings::msg_params] = msg_params;
+ hmi_requests.push_back(request);
+#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) {
+ 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);
+ (*request)[strings::msg_params] = msg_params;
+ hmi_requests.push_back(request);
+ }
+ }
+#endif // #ifdef HMI_DBUS_API
+ return hmi_requests;
+}
+
+void MessageHelper::SendOnButtonSubscriptionNotification(
+ uint32_t app_id,
+ hmi_apis::Common_ButtonName::eType button,
+ bool is_subscribed,
+ ApplicationManager& app_mngr) {
+ using namespace smart_objects;
+ using namespace hmi_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SmartObjectSPtr notification_ptr =
+ utils::MakeShared<SmartObject>(SmartType_Map);
+ if (!notification_ptr) {
+ LOG4CXX_ERROR(logger_, "Memory allocation failed.");
+ return;
+ }
+ SmartObject& notification = *notification_ptr;
+
+ SmartObject msg_params = SmartObject(SmartType_Map);
+ msg_params[strings::app_id] = app_id;
+ msg_params[strings::name] = button;
+ msg_params[strings::is_suscribed] = is_subscribed;
+
+ notification[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ notification[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ notification[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ notification[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Buttons_OnButtonSubscription;
+ notification[strings::msg_params] = msg_params;
+
+ if (!app_mngr.ManageHMICommand(notification_ptr)) {
+ LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
+ }
+}
+
+void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ using namespace smart_objects;
+ using namespace hmi_apis;
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer ");
+ return;
+ }
+
+ 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,
+ app_mngr);
+ }
+}
+
+void MessageHelper::SendSetAppIcon(
+ const uint32_t app_id,
+ const std::string& icon_path,
+ application_manager::ApplicationManager& application_manager) {
+ using namespace smart_objects;
+
+ SmartObjectSPtr set_app_icon =
+ CreateRequestObject(application_manager.GetNextHMICorrelationID());
+ 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::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;
+ }
+ application_manager.ManageHMICommand(set_app_icon);
+ }
+}
+
+void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_man) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (app) {
+ SendSetAppIcon(app, app->app_icon_path(), app_man);
+ SendGlobalPropertiesToHMI(app, app_man);
+ SendShowRequestToHMI(app, app_man);
+ }
+}
+
+void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return;
+ }
+
+ smart_objects::SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(
+ app, app_mngr.GetNextHMICorrelationID());
+ for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
+ it != requests.end();
+ ++it) {
+ DCHECK(app_mngr.ManageHMICommand(*it));
+ }
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObjectList requests;
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return requests;
+ }
+
+ // UI global properties
+
+ if (app->vr_help_title() || app->vr_help()) {
+ smart_objects::SmartObjectSPtr ui_global_properties =
+ CreateRequestObject(correlation_id);
+ if (!ui_global_properties) {
+ return requests;
+ }
+
+ (*ui_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
+
+ smart_objects::SmartObject ui_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->vr_help_title()) {
+ ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
+ }
+ if (app->vr_help()) {
+ ui_msg_params[strings::vr_help] = (*app->vr_help());
+ }
+ if (app->keyboard_props()) {
+ ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
+ }
+ if (app->menu_title()) {
+ ui_msg_params[strings::menu_title] = (*app->menu_title());
+ }
+ if (app->menu_icon()) {
+ ui_msg_params[strings::menu_icon] = (*app->menu_icon());
+ }
+ ui_msg_params[strings::app_id] = app->app_id();
+
+ (*ui_global_properties)[strings::msg_params] = ui_msg_params;
+
+ requests.push_back(ui_global_properties);
+ }
+
+ // TTS global properties
+ if (app->help_prompt() || app->timeout_prompt()) {
+ smart_objects::SmartObjectSPtr tts_global_properties =
+ CreateRequestObject(correlation_id);
+ if (!tts_global_properties) {
+ return requests;
+ }
+
+ (*tts_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+
+ smart_objects::SmartObject tts_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->help_prompt()) {
+ tts_msg_params[strings::help_prompt] = (*app->help_prompt());
+ }
+ if (app->timeout_prompt()) {
+ tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ }
+ tts_msg_params[strings::app_id] = app->app_id();
+
+ (*tts_global_properties)[strings::msg_params] = tts_msg_params;
+
+ requests.push_back(tts_global_properties);
+ }
+ return requests;
+}
+
+void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
+ bool default_help_prompt,
+ ApplicationManager& app_man) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ return;
+ }
+ smart_objects::SmartObjectSPtr tts_global_properties =
+ CreateRequestObject(app_man.GetNextHMICorrelationID());
+ 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);
+
+ 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();
+ CommandsMap::const_iterator it = commands.begin();
+ 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();
+ item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT;
+ } else {
+ continue;
+ }
+ msg_params[strings::help_prompt][index++] = item;
+ }
+ }
+ app->set_help_prompt(msg_params[strings::help_prompt]);
+ msg_params[strings::app_id] = app->app_id();
+ so_to_send[strings::msg_params] = msg_params;
+ app_man.ManageHMICommand(tts_global_properties);
+ }
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
+ ApplicationConstSharedPtr app) {
+ smart_objects::SmartObjectSPtr result =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ if (!result) {
+ return NULL;
+ }
+ smart_objects::SmartObject& vr_help = *result;
+ vr_help[strings::vr_help_title] = app->name();
+
+ int32_t index = 0;
+ if (app->vr_synonyms()) {
+ smart_objects::SmartObject item(smart_objects::SmartType_Map);
+ item[strings::text] = (*(app->vr_synonyms())).getElement(0);
+ item[strings::position] = index + 1;
+ vr_help[strings::vr_help][index++] = item;
+ }
+
+ // copy all app VR commands
+ const DataAccessor<CommandsMap> cmd_accessor = app->commands_map();
+ const CommandsMap& commands = cmd_accessor.GetData();
+ CommandsMap::const_iterator it = commands.begin();
+
+ for (; commands.end() != it; ++it) {
+ smart_objects::SmartObject item(smart_objects::SmartType_Map);
+ item[strings::text] = (*it->second)[strings::vr_commands][0].asString();
+ item[strings::position] = index + 1;
+ vr_help[strings::vr_help][index++] = item;
+ }
+ return result;
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id) {
+ smart_objects::SmartObjectList requests;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return requests;
+ }
+
+ if (app->show_command()) {
+ smart_objects::SmartObjectSPtr ui_show =
+ CreateRequestObject(correlation_id);
+ (*ui_show)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_Show);
+
+ (*ui_show)[strings::msg_params] = (*app->show_command());
+ requests.push_back(ui_show);
+ }
+ return requests;
+}
+
+void MessageHelper::SendShowRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ if (!app) {
+ return;
+ }
+ smart_objects::SmartObjectList shows =
+ CreateShowRequestToHMI(app, app_mngr.GetNextHMICorrelationID());
+
+ for (smart_objects::SmartObjectList::const_iterator it = shows.begin();
+ it != shows.end();
+ ++it) {
+ DCHECK(app_mngr.ManageHMICommand(*it));
+ }
+}
+
+void MessageHelper::SendShowConstantTBTRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_man) {
+ if (!app) {
+ return;
+ }
+
+ if (app->tbt_show_command()) {
+ smart_objects::SmartObjectSPtr navi_show_tbt =
+ CreateRequestObject(app_man.GetNextHMICorrelationID());
+ 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::msg_params] = (*app->tbt_show_command());
+ DCHECK(app_man.ManageHMICommand(navi_show_tbt));
+ }
+}
+
+void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_man) {
+ if (!app) {
+ return;
+ }
+ smart_objects::SmartObjectList requests =
+ CreateAddCommandRequestToHMI(app, app_man);
+ for (smart_objects::SmartObjectList::iterator it = requests.begin();
+ it != requests.end();
+ ++it) {
+ DCHECK(app_man.ManageHMICommand(*it));
+ }
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectList requests;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return requests;
+ }
+
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& commands = accessor.GetData();
+ CommandsMap::const_iterator i = commands.begin();
+ for (; commands.end() != i; ++i) {
+ // UI Interface
+ if ((*i->second).keyExists(strings::menu_params)) {
+ smart_objects::SmartObjectSPtr ui_command =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!ui_command) {
+ return requests;
+ }
+
+ (*ui_command)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
+
+ 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())) {
+ 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();
+ }
+ (*ui_command)[strings::msg_params] = msg_params;
+ requests.push_back(ui_command);
+ }
+
+ // VR Interface
+ if ((*i->second).keyExists(strings::vr_commands)) {
+ SendAddVRCommandToHMI(i->first,
+ (*i->second)[strings::vr_commands],
+ app->app_id(),
+ app_mngr);
+ }
+ }
+ return requests;
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ 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(app_mngr.GetNextHMICorrelationID());
+ 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(
+ const int32_t function_id,
+ const int32_t language,
+ const uint32_t app_id,
+ const smart_objects::SmartObject* app_types,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr command =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!command) {
+ return NULL;
+ }
+ smart_objects::SmartObject& params = *command;
+ params[strings::params][strings::function_id] = function_id;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::language] = language;
+ msg_params[strings::app_id] = app_id;
+
+ if (app_types != NULL) {
+ msg_params[strings::app_hmi_type] = *app_types;
+ }
+
+ params[strings::msg_params] = msg_params;
+ return command;
+}
+
+void MessageHelper::SendUIChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ 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(),
+ app_mngr);
+
+ if (ui_command) {
+ app_mngr.ManageHMICommand(ui_command);
+ }
+ }
+}
+
+void MessageHelper::SendChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ 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(),
+ NULL,
+ app_mngr);
+
+ if (vr_command) {
+ app_mngr.ManageHMICommand(vr_command);
+ }
+ }
+
+ if (mobile_apis::Language::INVALID_ENUM != app->language()) {
+ smart_objects::SmartObjectSPtr tts_command =
+ CreateChangeRegistration(hmi_apis::FunctionID::TTS_ChangeRegistration,
+ app->language(),
+ app->app_id(),
+ NULL,
+ app_mngr);
+
+ if (tts_command) {
+ app_mngr.ManageHMICommand(tts_command);
+ }
+ }
+
+ 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(),
+ NULL,
+ app_mngr);
+
+ if (ui_command) {
+ app_mngr.ManageHMICommand(ui_command);
+ }
+ }
+}
+
+void MessageHelper::SendAddVRCommandToHMI(
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr request =
+ CreateAddVRCommandToHMI(cmd_id, vr_commands, app_id, app_mngr);
+ DCHECK(app_mngr.ManageHMICommand(request));
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr vr_command =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!vr_command) {
+ return NULL;
+ }
+
+ (*vr_command)[strings::params][strings::function_id] =
+ 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;
+ }
+ msg_params[strings::vr_commands] = vr_commands;
+ if (0 < app_id) {
+ msg_params[strings::app_id] = app_id;
+ }
+ msg_params[strings::grammar_id] =
+ app_mngr.application(app_id)->get_grammar_id();
+ msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+
+ (*vr_command)[strings::msg_params] = msg_params;
+
+ return vr_command;
+}
+
+bool MessageHelper::CreateHMIApplicationStruct(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ NsSmartDeviceLink::NsSmartObjects::SmartObject* output,
+ ApplicationManager& app_mngr) {
+ using NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ DCHECK_OR_RETURN(output, false);
+ SmartObject& message = *output;
+
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Application is not valid");
+ return false;
+ }
+
+ const smart_objects::SmartObject* app_types = app->app_types();
+ const smart_objects::SmartObject* ngn_media_screen_name =
+ app->ngn_media_screen_name();
+ std::string device_name;
+ std::string mac_address;
+ std::string transport_type;
+ 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());
+ }
+
+ message = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ message[strings::app_name] = app->name();
+ message[strings::app_id] = app->hmi_app_id();
+ const std::string icon_path = app->app_icon_path();
+ if (!icon_path.empty()) {
+ message[strings::icon] = icon_path;
+ }
+ if (app->IsRegistered()) {
+ message[strings::hmi_display_language_desired] = app->ui_language();
+ message[strings::is_media_application] = app->is_media_application();
+ } else {
+ message[strings::greyOut] = app->is_greyed_out();
+ }
+ 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) {
+ message[strings::ngn_media_screen_app_name] =
+ ngn_media_screen_name->asString();
+ }
+ if (app_types) {
+ message[strings::app_type] = *app_types;
+ }
+
+ 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_handler.GetUserConsentForDevice(mac_address);
+ message[strings::device_info][strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+
+ message[strings::device_info][strings::transport_type] =
+ app_mngr.GetDeviceTransportType(transport_type);
+ return true;
+}
+
+void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return;
+ }
+
+ smart_objects::SmartObjectList requests =
+ CreateAddSubMenuRequestToHMI(app, app_mngr.GetNextHMICorrelationID());
+ for (smart_objects::SmartObjectList::iterator it = requests.begin();
+ it != requests.end();
+ ++it) {
+ DCHECK(app_mngr.ManageHMICommand(*it));
+ }
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id) {
+ 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 =
+ CreateRequestObject(correlation_id);
+ if (!ui_sub_menu) {
+ return requsets;
+ }
+
+ (*ui_sub_menu)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::UI_AddSubMenu;
+
+ 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];
+ msg_params[strings::menu_params][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);
+ }
+ return requsets;
+}
+
+void MessageHelper::SendOnAppUnregNotificationToHMI(
+ ApplicationConstSharedPtr app,
+ bool is_unexpected_disconnect,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr notification =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& message = *notification;
+
+ message[strings::params][strings::function_id] =
+ 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
+ message[strings::msg_params][strings::app_id] = app->hmi_app_id();
+ message[strings::msg_params][strings::unexpected_disconnect] =
+ is_unexpected_disconnect;
+ app_mngr.ManageHMICommand(notification);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority,
+ ApplicationManager& app_mngr) {
+ DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+
+ const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ 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->app_id();
+
+ if (send_policy_priority) {
+ std::string priority;
+ // TODO(KKolodiy): need remove method policy_manager
+
+ policy_handler.GetPriority(app->policy_app_id(), &priority);
+ // According SDLAQ-CRS-2794
+ // SDL have to send ActivateApp without "proirity" parameter to HMI.
+ // in case of unconsented device
+ const std::string& mac_adress = app->mac_address();
+
+ policy::DeviceConsent consent =
+ policy_handler.GetUserConsentForDevice(mac_adress);
+ if (!priority.empty() &&
+ (policy::DeviceConsent::kDeviceAllowed == consent)) {
+ (*message)[strings::msg_params][strings::priority] =
+ GetPriorityCode(priority);
+ }
+ }
+
+ // We haven't send HMI level to HMI in case it FULL.
+ if (hmi_apis::Common_HMILevel::INVALID_ENUM != level &&
+ hmi_apis::Common_HMILevel::FULL != level) {
+ (*message)[strings::msg_params][strings::activate_app_hmi_level] = level;
+ }
+ return message;
+}
+
+void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
+ application_manager::ApplicationConstSharedPtr app =
+ app_mngr.application(app_id);
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id);
+ return;
+ }
+
+ utils::SharedPtr<smart_objects::SmartObject> message =
+ utils::MakeShared<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;
+ (*message)[strings::params][strings::correlation_id] =
+ app_mngr.GetNextHMICorrelationID();
+ (*message)[strings::msg_params][strings::app_id] = app_id;
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendSDLActivateAppResponse(
+ policy::AppPermissions& permissions,
+ const uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::function_id] =
+ 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_;
+ (*message)[strings::params][strings::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]["isAppRevoked"] = permissions.appRevoked;
+ (*message)[strings::msg_params]["isAppPermissionsRevoked"] =
+ permissions.isAppPermissionsRevoked;
+
+ if (permissions.isAppPermissionsRevoked) {
+ FillAppRevokedPermissions(permissions, *message);
+ }
+
+ (*message)[strings::msg_params]["isPermissionsConsentNeeded"] =
+ permissions.appPermissionsConsentNeeded;
+
+ if (!permissions.priority.empty()) {
+ (*message)[strings::msg_params]["priority"] =
+ GetPriorityCode(permissions.priority);
+ }
+
+ // If application is revoked it should not be activated
+ if (permissions.appRevoked || !permissions.isSDLAllowed) {
+ return;
+ }
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendOnSDLConsentNeeded(
+ const policy::DeviceParams& device_info, ApplicationManager& app_man) {
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::SDL_OnSDLConsentNeeded;
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
+
+ (*message)[strings::msg_params]["device"]["id"] =
+ device_info.device_mac_address;
+ (*message)[strings::msg_params]["device"]["name"] = device_info.device_name;
+
+ app_man.ManageHMICommand(message);
+}
+
+void MessageHelper::SendPolicyUpdate(const std::string& file_path,
+ const int timeout,
+ const std::vector<int>& retries,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ smart_objects::SmartObject& object = *message;
+ object[strings::params][strings::function_id] =
+ 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);
+ for (size_t i = 0; i < retries.size(); ++i) {
+ object[strings::msg_params][hmi_request::retry][i] = retries[i];
+ }
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendGetUserFriendlyMessageResponse(
+ const std::vector<policy::UserFriendlyMessage>& msg,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::function_id] =
+ 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()) {
+ app_mngr.ManageHMICommand(message);
+ return;
+ }
+
+ const std::string messages = "messages";
+ (*message)[strings::msg_params][messages] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject& user_friendly_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);
+
+ smart_objects::SmartObject& obj = user_friendly_messages[index];
+ obj[message_code] = it->message_code;
+ }
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendGetListOfPermissionsResponse(
+ const std::vector<policy::FunctionalGroupPermission>& permissions,
+ const uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::function_id] =
+ 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& allowed_functions_array =
+ message[strings::msg_params][allowed_functions];
+
+ std::vector<policy::FunctionalGroupPermission>::const_iterator it =
+ permissions.begin();
+ std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
+ permissions.end();
+ for (uint32_t index = 0; it != it_end; ++it, ++index) {
+ 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;
+ item[strings::id] = (*it).group_id;
+ policy::GroupConsent permission_state = (*it).state;
+ // If state undefined, 'allowed' parameter should be absent
+ if (policy::kGroupUndefined != permission_state) {
+ item["allowed"] = policy::kGroupAllowed == permission_state;
+ }
+ }
+
+ app_mngr.ManageHMICommand(
+ utils::MakeShared<smart_objects::SmartObject>(message));
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
+ uint32_t connection_key,
+ int32_t function_id,
+ const uint32_t correlation_id,
+ int32_t result_code) {
+ smart_objects::SmartObject response_data(smart_objects::SmartType_Map);
+ response_data[strings::params][strings::function_id] = function_id;
+ response_data[strings::params][strings::message_type] =
+ 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_;
+ response_data[strings::params][strings::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;
+
+ return utils::MakeShared<smart_objects::SmartObject>(response_data);
+}
+
+void MessageHelper::SendNaviStartStream(const int32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr start_stream =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!start_stream) {
+ return;
+ }
+
+ (*start_stream)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Navigation_StartStream;
+
+ char url[100] = {'\0'};
+ if ("socket" == app_mngr.get_settings().video_server_type()) {
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "http://%s:%d",
+ app_mngr.get_settings().server_address().c_str(),
+ app_mngr.get_settings().video_streaming_port());
+ } else if ("pipe" == app_mngr.get_settings().video_server_type()) {
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ app_mngr.get_settings().named_video_pipe_path().c_str());
+ } else {
+ int snprintf_result =
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ app_mngr.get_settings().video_stream_file().c_str());
+ DCHECK(snprintf_result);
+ }
+
+ (*start_stream)[strings::msg_params][strings::app_id] = app_id;
+ (*start_stream)[strings::msg_params][strings::url] = url;
+
+ app_mngr.ManageHMICommand(start_stream);
+}
+
+void MessageHelper::SendNaviStopStream(const int32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr stop_stream =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!stop_stream) {
+ return;
+ }
+
+ (*stop_stream)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Navigation_StopStream;
+
+ (*stop_stream)[strings::msg_params][strings::app_id] = app_id;
+
+ app_mngr.ManageHMICommand(stop_stream);
+}
+
+void MessageHelper::SendAudioStartStream(const int32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr start_stream =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+
+ if (!start_stream) {
+ return;
+ }
+
+ (*start_stream)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Navigation_StartAudioStream;
+
+ char url[100] = {'\0'};
+ if ("socket" == app_mngr.get_settings().audio_server_type()) {
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "http://%s:%d",
+ app_mngr.get_settings().server_address().c_str(),
+ app_mngr.get_settings().audio_streaming_port());
+ } else if ("pipe" == app_mngr.get_settings().audio_server_type()) {
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ app_mngr.get_settings().named_audio_pipe_path().c_str());
+ } else {
+ int snprintf_result =
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ app_mngr.get_settings().audio_stream_file().c_str());
+ DCHECK(snprintf_result);
+ }
+
+ (*start_stream)[strings::msg_params][strings::app_id] = app_id;
+ (*start_stream)[strings::msg_params][strings::url] = url;
+
+ DCHECK(app_mngr.ManageHMICommand(start_stream));
+}
+
+void MessageHelper::SendAudioStopStream(const int32_t app_id,
+ ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr stop_stream =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+
+ if (!stop_stream) {
+ return;
+ }
+
+ (*stop_stream)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Navigation_StopAudioStream;
+
+ (*stop_stream)[strings::msg_params][strings::app_id] = app_id;
+
+ app_mngr.ManageHMICommand(stop_stream);
+}
+
+void MessageHelper::SendOnDataStreaming(
+ const protocol_handler::ServiceType service,
+ const bool available,
+ ApplicationManager& app_mngr) {
+ using namespace protocol_handler;
+ using namespace helpers;
+
+ if (!Compare<ServiceType, EQ, ONE>(
+ service, ServiceType::kAudio, ServiceType::kMobileNav)) {
+ return;
+ }
+
+ smart_objects::SmartObjectSPtr notification =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*notification)[strings::params][strings::function_id] =
+ ServiceType::kAudio == service
+ ? hmi_apis::FunctionID::Navigation_OnAudioDataStreaming
+ : hmi_apis::FunctionID::Navigation_OnVideoDataStreaming;
+ (*notification)[strings::params][strings::message_type] =
+ hmi_apis::messageType::notification;
+ (*notification)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ (*notification)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+
+ (*notification)[strings::msg_params]["available"] = available;
+
+ app_mngr.ManageHMICommand(notification);
+}
+
+bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) {
+ LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru");
+
+ smart_objects::SmartObjectSPtr result =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+
+ (*result)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::UI_EndAudioPassThru;
+
+ return app_mngr.ManageHMICommand(result);
+}
+
+bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) {
+ LOG4CXX_INFO(logger_, "MessageHelper::SendUnsubscribedWayPoints");
+
+ smart_objects::SmartObjectSPtr result =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+
+ (*result)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints;
+
+ return app_mngr.ManageHMICommand(result);
+}
+
+void MessageHelper::SendPolicySnapshotNotification(
+ uint32_t connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObject content(smart_objects::SmartType_Map);
+
+ if (!url.empty()) {
+ 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] =
+ 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, app_mngr);
+}
+
+void MessageHelper::SendSystemRequestNotification(
+ const uint32_t connection_key,
+ smart_objects::SmartObject& content,
+ ApplicationManager& app_mngr) {
+ 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::connection_key] = connection_key;
+
+#ifdef DEBUG
+ PrintSmartObject(content);
+#endif
+
+ DCHECK(app_mngr.ManageMobileCommand(
+ utils::MakeShared<smart_objects::SmartObject>(content),
+ commands::Command::ORIGIN_SDL));
+}
+
+void MessageHelper::SendLaunchApp(const uint32_t connection_key,
+ const std::string& urlSchema,
+ const std::string& packageName,
+ ApplicationManager& app_mngr) {
+ 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;
+ if (!urlSchema.empty()) {
+ content[strings::msg_params][strings::url] = urlSchema;
+ } else if (!packageName.empty()) {
+ content[strings::msg_params][strings::url] = packageName;
+ }
+
+ SendSystemRequestNotification(connection_key, content, app_mngr);
+}
+
+void MessageHelper::SendQueryApps(const uint32_t connection_key,
+ ApplicationManager& app_mngr) {
+ using namespace mobile_apis;
+
+ policy::PolicyHandlerInterface& policy_handler = app_mngr.GetPolicyHandler();
+
+ smart_objects::SmartObject content(smart_objects::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_header;
+
+ const int timeout = policy_handler.TimeoutExchange();
+
+ http_header[http_request::content_type] = "application/json";
+ http_header[http_request::connect_timeout] = timeout;
+ http_header[http_request::do_output] = true;
+ http_header[http_request::do_input] = true;
+ http_header[http_request::use_caches] = false;
+ http_header[http_request::request_method] = http_request::GET;
+ http_header[http_request::read_timeout] = timeout;
+ http_header[http_request::instance_follow_redirect] = false;
+ http_header[http_request::charset] = "utf-8";
+ http_header[http_request::content_lenght] = 0;
+
+ std::string data = http_header.toStyledString();
+ std::vector<uint8_t> binary_data(data.begin(), data.end());
+
+ content[strings::params][strings::binary_data] =
+ smart_objects::SmartObject(binary_data);
+ content[strings::msg_params][strings::file_type] = FileType::BINARY;
+
+ SendSystemRequestNotification(connection_key, content, app_mngr);
+}
+
+void MessageHelper::SendOnPermissionsChangeNotification(
+ uint32_t connection_key,
+ const policy::Permissions& permissions,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObject content(smart_objects::SmartType_Map);
+
+ content[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnPermissionsChangeID;
+ 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::connection_key] = connection_key;
+
+ content[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ // content[strings::msg_params][strings::app_id] = connection_key;
+
+ content[strings::msg_params]["permissionItem"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject& permissions_item_array =
+ 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);
+
+ smart_objects::SmartObject& permission_item =
+ 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);
+
+ smart_objects::SmartObject& hmi_permissions =
+ permission_item["hmiPermissions"];
+
+ 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();
+
+ // 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);
+
+ smart_objects::SmartObject& hmi_levels =
+ hmi_permissions[(*it_hmi_permissions).first];
+
+ std::set<policy::HMILevel>::const_iterator it_hmi_levels =
+ (*it_hmi_permissions).second.begin();
+ std::set<policy::HMILevel>::const_iterator it_hmi_levels_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) {
+ hmi_levels[index_hmi_levels] = *it_hmi_levels;
+ }
+ }
+
+ // Creating SO for parameterPermissions
+ permission_item["parameterPermissions"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& parameter_permissions =
+ permission_item["parameterPermissions"];
+
+ policy::ParameterPermissions::const_iterator it_parameter_permissions =
+ rpc_permissions.parameter_permissions.begin();
+ policy::ParameterPermissions::const_iterator it_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& parameters =
+ parameter_permissions[(*it_parameter_permissions).first];
+
+ std::set<policy::Parameter>::const_iterator it_parameters =
+ (*it_parameter_permissions).second.begin();
+ std::set<policy::Parameter>::const_iterator it_parameters_end =
+ (*it_parameter_permissions).second.end();
+
+ for (size_t index_parameters = 0; it_parameters != it_parameters_end;
+ ++it_parameters, ++index_parameters) {
+ parameters[index_parameters] = *it_parameters;
+ }
+ }
+ }
+
+ app_mngr.ManageMobileCommand(
+ utils::MakeShared<smart_objects::SmartObject>(content),
+ commands::Command::ORIGIN_SDL);
+}
+
+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& 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);
+ smart_objects::SmartObject& permission_item = revoked_permission_items[i];
+ permission_item["name"] = permissions.appRevokedPermissions[i].group_alias;
+
+ permission_item["id"] = permissions.appRevokedPermissions[i].group_id;
+
+ if (policy::kGroupUndefined != permissions.appRevokedPermissions[i].state) {
+ permission_item["allowed"] =
+ policy::kGroupAllowed == permissions.appRevokedPermissions[i].state
+ ? true
+ : false;
+ }
+ }
+}
+
+void MessageHelper::SendOnAppPermissionsChangedNotification(
+ const uint32_t connection_key,
+ const policy::AppPermissions& permissions,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::SDL_OnAppPermissionChanged;
+
+ message[strings::params][strings::message_type] = MessageType::kNotification;
+ message[strings::msg_params][strings::app_id] = connection_key;
+
+ // TODO(AOleynik): Add other parameters processing from incoming struct
+ if (permissions.appRevoked) {
+ message[strings::msg_params]["appRevoked"] = permissions.appRevoked;
+ }
+ if (permissions.isAppPermissionsRevoked) {
+ message[strings::msg_params]["isAppPermissionsRevoked"] =
+ permissions.isAppPermissionsRevoked;
+
+ FillAppRevokedPermissions(permissions, message);
+ }
+
+ if (permissions.appPermissionsConsentNeeded) {
+ message[strings::msg_params]["appPermissionsConsentNeeded"] =
+ permissions.appPermissionsConsentNeeded;
+ }
+ if (permissions.appUnauthorized) {
+ message[strings::msg_params]["appUnauthorized"] =
+ permissions.appUnauthorized;
+ }
+ if (!permissions.priority.empty()) {
+ message[strings::msg_params]["priority"] =
+ GetPriorityCode(permissions.priority);
+ }
+ if (permissions.requestTypeChanged) {
+ smart_objects::SmartObject request_types_array(
+ smart_objects::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;
+ }
+
+ app_mngr.ManageHMICommand(
+ utils::MakeShared<smart_objects::SmartObject>(message));
+}
+
+void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
+ const uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<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;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::params][hmi_response::code] = 0;
+
+ (*message)[strings::msg_params]["status"] = status;
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendUpdateSDLResponse(const std::string& result,
+ const uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<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;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::params][hmi_response::code] = 0;
+
+ (*message)[strings::msg_params]["result"] = result;
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendOnStatusUpdate(const std::string& status,
+ ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ if (!message) {
+ return;
+ }
+
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::SDL_OnStatusUpdate;
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
+
+ (*message)[strings::msg_params]["status"] = status;
+
+ app_mngr.ManageHMICommand(message);
+}
+
+void MessageHelper::SendGetSystemInfoRequest(ApplicationManager& app_mngr) {
+ smart_objects::SmartObjectSPtr message =
+ CreateRequestObject(app_mngr.GetNextHMICorrelationID());
+ if (!message) {
+ return;
+ }
+
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_GetSystemInfo;
+
+ app_mngr.ManageHMICommand(message);
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ 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, app_mngr);
+ if (mobile_apis::Result::SUCCESS != res) {
+ LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
+ return res;
+ }
+ }
+ } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map ==
+ message.getType()) {
+ if (message.keyExists(strings::image_type)) {
+ mobile_apis::Result::eType verification_result =
+ VerifyImage(message, app, app_mngr);
+
+ if (mobile_apis::Result::SUCCESS != 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) {
+ if (strings::soft_buttons != (*key)) {
+ mobile_apis::Result::eType res =
+ VerifyImageFiles(message[*key], app, app_mngr);
+ if (mobile_apis::Result::SUCCESS != res) {
+ LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
+ return res;
+ }
+ }
+ }
+ }
+ } // all other types shoudn't be processed
+
+ return mobile_apis::Result::SUCCESS;
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImage(
+ smart_objects::SmartObject& image,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ // 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);
+ if (mobile_apis::ImageType::STATIC == type) {
+ return mobile_apis::Result::SUCCESS;
+ }
+
+ const std::string& file_name = image[strings::value].asString();
+
+ std::string str = file_name;
+ str.erase(remove(str.begin(), str.end(), ' '), str.end());
+ if (0 == str.size()) {
+ return mobile_apis::Result::INVALID_DATA;
+ }
+
+ std::string full_file_path;
+ if (file_name.size() > 0 && file_name[0] == '/') {
+ full_file_path = file_name;
+ } else {
+ const std::string& app_storage_folder =
+ app_mngr.get_settings().app_storage_folder();
+ if (!app_storage_folder.empty()) {
+ // TODO(nvaganov@luxoft.com): APPLINK-11293
+ if (app_storage_folder[0] == '/') { // absolute path
+ full_file_path = app_storage_folder + "/";
+ } else { // relative path
+ full_file_path = file_system::CurrentWorkingDirectory() + "/" +
+ app_storage_folder + "/";
+ }
+ } else { // empty app storage folder
+ full_file_path = file_system::CurrentWorkingDirectory() + "/";
+ }
+
+ full_file_path += app->folder_name();
+ full_file_path += "/";
+ full_file_path += file_name;
+ }
+
+ if (!file_system::FileExists(full_file_path)) {
+ return mobile_apis::Result::INVALID_DATA;
+ }
+
+ image[strings::value] = full_file_path;
+
+ return mobile_apis::Result::SUCCESS;
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ mobile_apis::Result::eType verification_result_image =
+ 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, app_mngr);
+ if (mobile_apis::Result::SUCCESS != verification_result_image) {
+ return verification_result_image;
+ }
+ }
+ }
+ return mobile_apis::Result::SUCCESS;
+}
+
+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"
+ "string contains incorrect character");
+ return false;
+ }
+ return true;
+}
+
+bool CheckWithPolicy(mobile_api::SystemAction::eType system_action,
+ const std::string& app_mobile_id,
+ const policy::PolicyHandlerInterface& policy_handler) {
+ using namespace mobile_apis;
+ bool result = true;
+ if (policy_handler.PolicyEnabled()) {
+ result = policy_handler.CheckSystemAction(system_action, app_mobile_id);
+ }
+ return result;
+}
+
+mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
+ smart_objects::SmartObject& message_params,
+ ApplicationConstSharedPtr app,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr) {
+ using namespace mobile_apis;
+ using namespace smart_objects;
+
+ if (!message_params.keyExists(strings::soft_buttons)) {
+ return mobile_apis::Result::SUCCESS;
+ }
+
+ SmartObject& request_soft_buttons = message_params[strings::soft_buttons];
+
+ // Check whether soft buttons request is well-formed
+ if (!ValidateSoftButtons(request_soft_buttons)) {
+ return Result::INVALID_DATA;
+ }
+
+ SmartObject soft_buttons(SmartType_Array);
+
+ 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();
+
+ if (!CheckWithPolicy(static_cast<SystemAction::eType>(system_action),
+ app->policy_app_id(),
+ policy_handler)) {
+ return Result::DISALLOWED;
+ }
+
+ switch (request_soft_buttons[i][strings::type].asInt()) {
+ case SoftButtonType::SBT_IMAGE: {
+ // 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::SUCCESS !=
+ VerifyImage(
+ request_soft_buttons[i][strings::image], app, app_mngr)))) {
+ return Result::INVALID_DATA;
+ }
+ break;
+ }
+ case SoftButtonType::SBT_TEXT: {
+ if (request_soft_buttons[i].keyExists(strings::image)) {
+ request_soft_buttons[i].erase(strings::image);
+ }
+ if ((!request_soft_buttons[i].keyExists(strings::text)) ||
+ (!VerifySoftButtonString(
+ request_soft_buttons[i][strings::text].asString()))) {
+ return Result::INVALID_DATA;
+ }
+ 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())))) {
+ return Result::INVALID_DATA;
+ }
+
+ if ((!request_soft_buttons[i].keyExists(strings::image) ||
+ (Result::SUCCESS !=
+ VerifyImage(
+ request_soft_buttons[i][strings::image], app, app_mngr)))) {
+ return Result::INVALID_DATA;
+ }
+ break;
+ }
+ default: {
+ continue;
+ break;
+ }
+ }
+
+ soft_buttons[j++] = request_soft_buttons[i];
+ }
+
+ request_soft_buttons = soft_buttons;
+
+ if (0 == request_soft_buttons.length()) {
+ message_params.erase(strings::soft_buttons);
+ }
+ return Result::SUCCESS;
+}
+
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id) {
+ SoftButtonID softbuttons_id;
+ smart_objects::SmartObject& soft_buttons =
+ message_params[strings::soft_buttons];
+ unsigned int length = soft_buttons.length();
+ for (unsigned int i = 0; i < length; ++i) {
+ softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
+ }
+ app->SubscribeToSoftButtons(function_id, softbuttons_id);
+}
+
+// TODO(AK): change printf to logger
+bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
+ return true;
+#ifdef ENABLE_LOG
+ static uint32_t tab = 0;
+ std::string tab_buffer;
+
+ if (tab == 0) {
+ printf("\n-------------------------------------------------------------");
+ }
+
+ for (uint32_t i = 0; i < tab; ++i) {
+ tab_buffer += "\t";
+ }
+
+ switch (object.getType()) {
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Array: {
+ for (size_t i = 0; i < object.length(); i++) {
+ ++tab;
+
+ printf("\n%s%zu: ", tab_buffer.c_str(), i);
+ if (!PrintSmartObject(object.getElement(i))) {
+ printf("\n");
+ return false;
+ }
+ }
+ break;
+ }
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Map: {
+ std::set<std::string> keys = object.enumerate();
+
+ for (std::set<std::string>::const_iterator key = keys.begin();
+ key != keys.end();
+ key++) {
+ ++tab;
+
+ printf("\n%s%s: ", tab_buffer.c_str(), (*key).c_str());
+ if (!PrintSmartObject(object[(*key).c_str()])) {
+ printf("\n");
+ return false;
+ }
+ }
+ break;
+ }
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean:
+ object.asBool() ? printf("true\n") : printf("false\n");
+ break;
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Double: {
+ printf("%f", object.asDouble());
+ break;
+ }
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Integer:
+ break;
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_String:
+ printf("%s", object.asString().c_str());
+ break;
+ case NsSmartDeviceLink::NsSmartObjects::SmartType_Character:
+ printf("%c", object.asChar());
+ break;
+ default:
+ printf("PrintSmartObject - default case\n");
+ break;
+ }
+
+ if (0 != tab) {
+ --tab;
+ } else {
+ printf("\n-------------------------------------------------------------\n");
+ }
+#endif
+ return true;
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc
index 2bb1dff921..688bacf1ac 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"
@@ -59,6 +58,8 @@
#include "application_manager/commands/mobile/get_dtcs_response.h"
#include "application_manager/commands/mobile/get_vehicle_data_request.h"
#include "application_manager/commands/mobile/get_vehicle_data_response.h"
+#include "application_manager/commands/mobile/get_way_points_request.h"
+#include "application_manager/commands/mobile/get_way_points_response.h"
#include "application_manager/commands/mobile/list_files_request.h"
#include "application_manager/commands/mobile/list_files_response.h"
#include "application_manager/commands/mobile/on_app_interface_unregistered_notification.h"
@@ -74,6 +75,7 @@
#include "application_manager/commands/mobile/on_tbt_client_state_notification.h"
#include "application_manager/commands/mobile/on_vehicle_data_notification.h"
#include "application_manager/commands/mobile/on_hash_change_notification.h"
+#include "application_manager/commands/mobile/on_way_point_change_notification.h"
#include "application_manager/commands/mobile/perform_audio_pass_thru_request.h"
#include "application_manager/commands/mobile/perform_audio_pass_thru_response.h"
#include "application_manager/commands/mobile/perform_interaction_request.h"
@@ -108,6 +110,10 @@
#include "application_manager/commands/mobile/subscribe_button_response.h"
#include "application_manager/commands/mobile/subscribe_vehicle_data_request.h"
#include "application_manager/commands/mobile/subscribe_vehicle_data_response.h"
+#include "application_manager/commands/mobile/subscribe_way_points_request.h"
+#include "application_manager/commands/mobile/subscribe_way_points_response.h"
+#include "application_manager/commands/mobile/unsubscribe_way_points_request.h"
+#include "application_manager/commands/mobile/unsubscribe_way_points_response.h"
#include "application_manager/commands/mobile/unregister_app_interface_request.h"
#include "application_manager/commands/mobile/unregister_app_interface_response.h"
#include "application_manager/commands/mobile/unsubscribe_button_request.h"
@@ -128,438 +134,569 @@
#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) {
+ commands::Command::CommandOrigin origin,
+ ApplicationManager& application_manager) {
+ 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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kRequest)) {
+ command.reset(new commands::RegisterAppInterfaceRequest(
+ message, application_manager));
+
} else {
- return new commands::RegisterAppInterfaceResponse(message);
+ command.reset(new commands::RegisterAppInterfaceResponse(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kRequest)) {
+ command.reset(new commands::UnregisterAppInterfaceRequest(
+ message, application_manager));
} else {
- return new commands::UnregisterAppInterfaceResponse(message);
+ command.reset(new commands::UnregisterAppInterfaceResponse(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::SetGlobalPropertiesResponse(
+ message, application_manager));
} else {
- return new commands::SetGlobalPropertiesRequest(message);
+ command.reset(new commands::SetGlobalPropertiesRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::ResetGlobalPropertiesResponse(
+ message, application_manager));
} else {
- return new commands::ResetGlobalPropertiesRequest(message);
+ command.reset(new commands::ResetGlobalPropertiesRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::AddCommandResponse(message, application_manager));
} else {
- return new commands::AddCommandRequest(message);
+ command.reset(
+ new commands::AddCommandRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::DeleteCommandResponse(message, application_manager));
} else {
- return new commands::DeleteCommandRequest(message);
+ command.reset(
+ new commands::DeleteCommandRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::AddSubMenuResponse(message, application_manager));
} else {
- return new commands::AddSubMenuRequest(message);
+ command.reset(
+ new commands::AddSubMenuRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::DeleteSubMenuResponse(message, application_manager));
} else {
- return new commands::DeleteSubMenuRequest(message);
+ command.reset(
+ new commands::DeleteSubMenuRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::DeleteInteractionChoiceSetResponse(
+ message, application_manager));
} else {
- return new commands::DeleteInteractionChoiceSetRequest(message);
+ command.reset(new commands::DeleteInteractionChoiceSetRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::AlertResponse(message, application_manager));
} else {
- return new commands::AlertRequest(message);
+ command.reset(new commands::AlertRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::SpeakResponse(message, application_manager));
} else {
- return new commands::SpeakRequest(message);
+ command.reset(new commands::SpeakRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::SliderResponse(message, application_manager));
} else {
- return new commands::SliderRequest(message);
+ command.reset(
+ new commands::SliderRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::PerformAudioPassThruResponse(
+ message, application_manager));
} else {
- return new commands::PerformAudioPassThruRequest(message);
+ command.reset(new commands::PerformAudioPassThruRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::CreateInteractionChoiceSetResponse(
+ message, application_manager));
} else {
- return new commands::CreateInteractionChoiceSetRequest(message);
+ command.reset(new commands::CreateInteractionChoiceSetRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::PerformInteractionResponse(
+ message, application_manager));
} else {
- return new commands::PerformInteractionRequest(message);
+ command.reset(new commands::PerformInteractionRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::EndAudioPassThruResponse(
+ message, application_manager));
} else {
- return new commands::EndAudioPassThruRequest(message);
+ command.reset(new commands::EndAudioPassThruRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::PutFileResponse(message, application_manager));
} else {
- return new commands::PutFileRequest(message);
+ command.reset(
+ new commands::PutFileRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::DeleteFileResponse(message, application_manager));
} else {
- return new commands::DeleteFileRequest(message);
+ command.reset(
+ new commands::DeleteFileRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::ListFilesResponse(message, application_manager));
} else {
- return new commands::ListFilesRequest(message);
+ command.reset(
+ new commands::ListFilesRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::SubscribeButtonResponse(
+ message, application_manager));
} else {
- return new commands::SubscribeButtonRequest(message);
+ command.reset(
+ new commands::SubscribeButtonRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::UnsubscribeButtonResponse(
+ message, application_manager));
} else {
- return new commands::UnsubscribeButtonRequest(message);
+ command.reset(new commands::UnsubscribeButtonRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::ShowConstantTBTResponse(
+ message, application_manager));
} else {
- return new commands::ShowConstantTBTRequest(message);
+ command.reset(
+ new commands::ShowConstantTBTRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::ShowResponse(message, application_manager));
} else {
- return new commands::ShowRequest(message);
+ command.reset(new commands::ShowRequest(message, application_manager));
+ }
+ break;
+ }
+ case mobile_apis::FunctionID::GetWayPointsID: {
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command = utils::MakeShared<commands::GetWayPointsResponse>(
+ message, application_manager);
+ } else {
+ command = utils::MakeShared<commands::GetWayPointsRequest>(
+ message, application_manager);
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::SubscribeVehicleDataResponse(
+ message, application_manager));
} else {
- return new commands::SubscribeVehicleDataRequest(message);
+ command.reset(new commands::SubscribeVehicleDataRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::UnsubscribeVehicleDataResponse(
+ message, application_manager));
} else {
- return new commands::UnsubscribeVehicleDataRequest(message);
+ command.reset(new commands::UnsubscribeVehicleDataRequest(
+ message, application_manager));
+ }
+ break;
+ }
+ case mobile_apis::FunctionID::SubscribeWayPointsID: {
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command = utils::MakeShared<commands::SubscribeWayPointsResponse>(
+ message, application_manager);
+ } else {
+ command = utils::MakeShared<commands::SubscribeWayPointsRequest>(
+ message, application_manager);
+ }
+ break;
+ }
+ case mobile_apis::FunctionID::UnsubscribeWayPointsID: {
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command = utils::MakeShared<commands::UnsubscribeWayPointsResponse>(
+ message, application_manager);
+ } else {
+ command = utils::MakeShared<commands::UnSubscribeWayPointsRequest>(
+ message, application_manager);
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::ReadDIDResponse(message, application_manager));
} else {
- return new commands::ReadDIDRequest(message);
+ command.reset(
+ new commands::ReadDIDRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::GetVehicleDataResponse(message, application_manager));
} else {
- return new commands::GetVehicleDataRequest(message);
+ command.reset(
+ new commands::GetVehicleDataRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::ScrollableMessageResponse(
+ message, application_manager));
} else {
- return new commands::ScrollableMessageRequest(message);
+ command.reset(new commands::ScrollableMessageRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::AlertManeuverResponse(message, application_manager));
} else {
- return new commands::AlertManeuverRequest(message);
+ command.reset(
+ new commands::AlertManeuverRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::SetAppIconResponse(message, application_manager));
} else {
- return new commands::SetAppIconRequest(message);
+ command.reset(
+ new commands::SetAppIconRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::SetDisplayLayoutResponse(
+ message, application_manager));
} else {
- return new commands::SetDisplayLayoutRequest(message);
+ command.reset(new commands::SetDisplayLayoutRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::UpdateTurnListResponse(message, application_manager));
} else {
- return new commands::UpdateTurnListRequest(message);
+ command.reset(
+ new commands::UpdateTurnListRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::ChangeRegistrationResponse(
+ message, application_manager));
} else {
- return new commands::ChangeRegistrationRequest(message);
+ command.reset(new commands::ChangeRegistrationRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::GetDTCsResponse(message, application_manager));
} else {
- return new commands::GetDTCsRequest(message);
+ command.reset(
+ new commands::GetDTCsRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::DiagnosticMessageResponse(
+ message, application_manager));
} else {
- return new commands::DiagnosticMessageRequest(message);
+ command.reset(new commands::DiagnosticMessageRequest(
+ message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(new commands::SetMediaClockTimerResponse(
+ message, application_manager));
} else {
- return new commands::SetMediaClockRequest(message);
+ command.reset(
+ new commands::SetMediaClockRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::SystemResponse(message, application_manager));
} else {
- return new commands::SystemRequest(message);
+ command.reset(
+ new commands::SystemRequest(message, application_manager));
}
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);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::SendLocationResponse(message, application_manager));
} else {
- return new commands::SendLocationRequest(message);
+ command.reset(
+ new commands::SendLocationRequest(message, application_manager));
}
break;
}
case mobile_apis::FunctionID::DialNumberID: {
- if ((*message)[strings::params][strings::message_type]
- == static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::DialNumberResponse(message);
+ if ((*message)[strings::params][strings::message_type] ==
+ static_cast<int>(application_manager::MessageType::kResponse)) {
+ command.reset(
+ new commands::DialNumberResponse(message, application_manager));
} else {
- return new commands::DialNumberRequest(message);
+ command.reset(
+ new commands::DialNumberRequest(message, application_manager));
}
break;
}
case mobile_apis::FunctionID::OnButtonEventID: {
- return new commands::mobile::OnButtonEventNotification(message);
+ command.reset(new commands::mobile::OnButtonEventNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnButtonPressID: {
- return new commands::mobile::OnButtonPressNotification(message);
+ command.reset(new commands::mobile::OnButtonPressNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnAudioPassThruID: {
- return new commands::OnAudioPassThruNotification(message);
+ command.reset(new commands::OnAudioPassThruNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnVehicleDataID: {
- return new commands::OnVehicleDataNotification(message);
+ command.reset(new commands::OnVehicleDataNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnAppInterfaceUnregisteredID: {
- return
- new commands::OnAppInterfaceUnregisteredNotification(message);
+ command.reset(new commands::OnAppInterfaceUnregisteredNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnCommandID: {
- return new commands::OnCommandNotification(message);
+ command.reset(
+ new commands::OnCommandNotification(message, application_manager));
break;
}
case mobile_apis::FunctionID::OnTBTClientStateID: {
- return new commands::OnTBTClientStateNotification(message);
+ command.reset(new commands::OnTBTClientStateNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnDriverDistractionID: {
- return
- new commands::mobile::OnDriverDistractionNotification(message);
+ command.reset(new commands::mobile::OnDriverDistractionNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnLanguageChangeID: {
- return new commands::OnLanguageChangeNotification(message);
+ command.reset(new commands::OnLanguageChangeNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnPermissionsChangeID: {
- return new commands::OnPermissionsChangeNotification(message);
+ command.reset(new commands::OnPermissionsChangeNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnHMIStatusID: {
- if (origin == commands::Command::ORIGIN_MOBILE) {
- return new commands::OnHMIStatusNotificationFromMobile(message);
+ if (commands::Command::ORIGIN_SDL == origin) {
+ command.reset(new commands::OnHMIStatusNotification(
+ message, application_manager));
+ } else {
+ command.reset(new commands::OnHMIStatusNotificationFromMobile(
+ message, application_manager));
}
- return new commands::OnHMIStatusNotification(message);
break;
}
case mobile_apis::FunctionID::OnKeyboardInputID: {
- return new commands::mobile::OnKeyBoardInputNotification(message);
+ command.reset(new commands::mobile::OnKeyBoardInputNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnTouchEventID: {
- return new commands::mobile::OnTouchEventNotification(message);
+ command.reset(new commands::mobile::OnTouchEventNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnSystemRequestID: {
- return new commands::mobile::OnSystemRequestNotification(message);
+ command.reset(new commands::mobile::OnSystemRequestNotification(
+ message, application_manager));
break;
}
case mobile_apis::FunctionID::OnHashChangeID: {
- return new commands::mobile::OnHashChangeNotification(message);
+ command.reset(new commands::mobile::OnHashChangeNotification(
+ message, application_manager));
+ break;
+ }
+ case mobile_apis::FunctionID::OnWayPointChangeID: {
+ command = utils::MakeShared<commands::OnWayPointChangeNotification>(
+ message, application_manager);
break;
}
default: {
(*message)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::GenericResponseID);
- return new commands::GenericResponse(message);
+ command.reset(
+ new commands::GenericResponse(message, application_manager));
}
}
+ 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..09d9512b19 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,45 +53,88 @@ 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);
+application_manager::Message*
+MobileMessageHandler::HandleIncomingMessageProtocol(
+ const protocol_handler::RawMessagePtr 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) {
+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;
}
-
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV1(
- const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleIncomingMessageProtocolV1()");
+ const ::protocol_handler::RawMessagePtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
application_manager::Message* outgoing_message =
- new application_manager::Message(
- protocol_handler::MessagePriority::FromServiceType(
- message->service_type())
- );
+ new application_manager::Message(
+ protocol_handler::MessagePriority::FromServiceType(
+ message->service_type()));
if (!message) {
NOTREACHED();
return NULL;
@@ -98,11 +142,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
outgoing_message->set_connection_key(message->connection_key());
outgoing_message->set_protocol_version(
- static_cast<application_manager::ProtocolVersion>(message
- ->protocol_version()));
- outgoing_message->set_json_message(
- std::string(reinterpret_cast<const char*>(message->data()),
- message->data_size()));
+ static_cast<application_manager::ProtocolVersion>(
+ message->protocol_version()));
+ outgoing_message->set_json_message(std::string(
+ reinterpret_cast<const char*>(message->data()), message->data_size()));
if (outgoing_message->json_message().empty()) {
delete outgoing_message;
@@ -114,20 +157,18 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV2(
- const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleIncomingMessageProtocolV2()");
-
+ const ::protocol_handler::RawMessagePtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
utils::BitStream message_bytestream(message->data(), message->data_size());
protocol_handler::ProtocolPayloadV2 payload;
- protocol_handler::Extract(&message_bytestream, &payload,
- message->data_size());
+ protocol_handler::Extract(
+ &message_bytestream, &payload, message->data_size());
// Silently drop message if it wasn't parsed correctly
if (message_bytestream.IsBad()) {
- LOG4CXX_WARN(logger_,
- "Drop ill-formed message from mobile, partially parsed: "
- << payload);
+ LOG4CXX_WARN(
+ logger_,
+ "Drop ill-formed message from mobile, partially parsed: " << payload);
return NULL;
}
@@ -143,8 +184,8 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
outgoing_message->set_correlation_id(int32_t(payload.header.correlation_id));
outgoing_message->set_connection_key(message->connection_key());
outgoing_message->set_protocol_version(
- static_cast<application_manager::ProtocolVersion>(message
- ->protocol_version()));
+ static_cast<application_manager::ProtocolVersion>(
+ message->protocol_version()));
outgoing_message->set_data_size(message->data_size());
outgoing_message->set_payload_size(message->payload_size());
@@ -157,13 +198,11 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV1(
- const MobileMessage& message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleOutgoingMessageProtocolV1()");
+ const MobileMessage& message) {
+ LOG4CXX_AUTO_TRACE(logger_);
std::string messageString = message->json_message();
if (messageString.length() == 0) {
- LOG4CXX_INFO(logger_,
- "Drop ill-formed message from mobile");
+ LOG4CXX_WARN(logger_, "Drop ill-formed message from mobile");
return NULL;
}
@@ -171,18 +210,17 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1(
memcpy(rawMessage, messageString.c_str(), messageString.length() + 1);
protocol_handler::RawMessage* result = new protocol_handler::RawMessage(
- message->connection_key(), 1, rawMessage, messageString.length() + 1);
+ message->connection_key(), 1, rawMessage, messageString.length() + 1);
- delete [] rawMessage;
+ delete[] rawMessage;
return result;
}
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV2(
- const MobileMessage& message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleOutgoingMessageProtocolV2()");
+ const MobileMessage& message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (message->json_message().length() == 0) {
LOG4CXX_ERROR(logger_, "json string is empty.");
}
@@ -231,10 +269,10 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2(
dataForSending[offset++] = jsonSize;
memcpy(dataForSending + offset, message->json_message().c_str(), jsonSize);
-
+
// Default the service type to RPC Service
- uint8_t type = 0x07;
-
+ uint8_t type = 0x07;
+
if (message->has_binary_data()) {
// Change the service type to Hybrid Service
type = 0x0F;
@@ -246,13 +284,13 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2(
}
protocol_handler::RawMessage* msgToProtocolHandler =
- new protocol_handler::RawMessage(message->connection_key(),
- message->protocol_version(),
- dataForSending,
- dataForSendingSize,
- type);
+ new protocol_handler::RawMessage(message->connection_key(),
+ message->protocol_version(),
+ dataForSending,
+ dataForSendingSize,
+ type);
- delete [] dataForSending;
+ delete[] dataForSending;
return msgToProtocolHandler;
}
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..7b5954a3c3 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
@@ -31,25 +31,26 @@
*/
#include "application_manager/policies/delegates/app_permission_delegate.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_manager.h"
namespace policy {
- CREATE_LOGGERPTR_GLOBAL(logger_, "AppPermissionDelegate")
+CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
- AppPermissionDelegate::AppPermissionDelegate(
- const uint32_t connection_key, const PermissionConsent& permissions)
- : connection_key_(connection_key),
- permissions_(permissions) {
- }
+AppPermissionDelegate::AppPermissionDelegate(
+ const uint32_t connection_key,
+ const PermissionConsent& permissions,
+ policy::PolicyHandlerInterface& policy_handler)
+ : connection_key_(connection_key)
+ , permissions_(permissions)
+ , policy_handler_(policy_handler) {}
- void AppPermissionDelegate::threadMain() {
+void AppPermissionDelegate::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
- PolicyHandler::instance()->OnAppPermissionConsentInternal(connection_key_,
- permissions_);
+ policy_handler_.OnAppPermissionConsentInternal(connection_key_, permissions_);
}
void AppPermissionDelegate::exitThreadMain() {
// Do nothing
}
-} // namespace policy
+} // namespace policy
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 a1f46a0373..e668be4ed1 100644
--- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
@@ -33,83 +33,83 @@
#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),
- global_counter_(type),
- app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE),
- app_info_(usage_statistics::AppInfoId::APP_INFO_NONE),
- stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE),
- app_id_(""),
- value_(""),
- timespan_seconds_(0) {
-
- }
-
- StatisticsDelegate::StatisticsDelegate(const std::string& app_id,
+StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
+ usage_statistics::GlobalCounterId type)
+ : type_(INCREMENT_GLOBAL)
+ , global_counter_(type)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
+ , app_id_("")
+ , value_("")
+ , timespan_seconds_(0)
+ , policy_handler_(policy_handler) {}
+
+StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
usage_statistics::AppCounterId type)
- : type_(INCREMENT_APP),
- global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE),
- app_counter_(type),
- app_info_(usage_statistics::AppInfoId::APP_INFO_NONE),
- stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE),
- app_id_(app_id),
- value_(""),
- timespan_seconds_(0) {
-
- }
-
- StatisticsDelegate::StatisticsDelegate(const std::string& app_id,
+ : type_(INCREMENT_APP)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
+ , app_counter_(type)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
+ , app_id_(app_id)
+ , value_("")
+ , timespan_seconds_(0)
+ , policy_handler_(policy_handler) {}
+
+StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
usage_statistics::AppInfoId type,
const std::string& value)
- : type_(SET),
- global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE),
- app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE),
- app_info_(type),
- stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE),
- app_id_(app_id),
- value_(value),
- timespan_seconds_(0) {
-
- }
-
- StatisticsDelegate::StatisticsDelegate(const std::string& app_id,
+ : type_(SET)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
+ , app_info_(type)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
+ , app_id_(app_id)
+ , value_(value)
+ , timespan_seconds_(0)
+ , policy_handler_(policy_handler) {}
+
+StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
+ const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds)
- : type_(ADD),
- global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE),
- app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE),
- app_info_(usage_statistics::AppInfoId::APP_INFO_NONE),
- stop_watch_(type),
- app_id_(app_id),
- value_(""),
- timespan_seconds_(timespan_seconds) {
-
+ : type_(ADD)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
+ , stop_watch_(type)
+ , app_id_(app_id)
+ , value_("")
+ , timespan_seconds_(timespan_seconds)
+ , policy_handler_(policy_handler) {}
+
+void StatisticsDelegate::threadMain() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ switch (type_) {
+ case INCREMENT_GLOBAL:
+ policy_handler_.Increment(global_counter_);
+ break;
+ case INCREMENT_APP:
+ policy_handler_.Increment(app_id_, app_counter_);
+ break;
+ case SET:
+ policy_handler_.Set(app_id_, app_info_, value_);
+ break;
+ case ADD:
+ policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_);
+ break;
+ default:
+ LOG4CXX_ERROR(logger_, "Unknown statistics operator");
+ break;
}
+}
- void StatisticsDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- switch (type_) {
- case INCREMENT_GLOBAL:
- PolicyHandler::instance()->Increment(global_counter_);
- break;
- case INCREMENT_APP:
- PolicyHandler::instance()->Increment(app_id_, app_counter_);
- break;
- case SET:
- PolicyHandler::instance()->Set(app_id_, app_info_, value_);
- break;
- case ADD:
- PolicyHandler::instance()->Add(app_id_, stop_watch_, timespan_seconds_);
- break;
- default:
- LOG4CXX_ERROR(logger_,"Unknown statistics operator");
- break;
- }
- }
-
- void StatisticsDelegate::exitThreadMain() {
- // Do nothing
- }
-} // namespace policy
+void StatisticsDelegate::exitThreadMain() {
+ // Do nothing
+}
+} // namespace policy
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..492abe499a 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -43,11 +43,13 @@ class PolicyHandler;
CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
-PolicyEventObserver::PolicyEventObserver(PolicyHandler* const policy_handler)
- : policy_handler_(policy_handler) {
-}
+PolicyEventObserver::PolicyEventObserver(
+ policy::PolicyHandlerInterface* const policy_handler,
+ application_manager::event_engine::EventDispatcher& event_dispatcher)
+ : EventObserver(event_dispatcher), policy_handler_(policy_handler) {}
-void PolicyEventObserver::set_policy_handler(policy::PolicyHandler* const policy_handler) {
+void PolicyEventObserver::set_policy_handler(
+ PolicyHandlerInterface* const policy_handler) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(policy_handler_lock_);
LOG4CXX_DEBUG(logger_, "Set policy handler " << policy_handler);
@@ -67,10 +69,8 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
ProcessOdometerEvent(message);
break;
}
- default: {
- break;
- }
- unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetOdometer);
+ default: { break; }
+ unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetOdometer);
#else
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
ProcessOdometerEvent(message);
@@ -82,27 +82,21 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
break;
}
- default: {
- break;
- }
+ default: { break; }
#endif
}
}
-void PolicyEventObserver::ProcessOdometerEvent(const smart_objects::SmartObject& message) {
- if (hmi_apis::Common_Result::SUCCESS
- == static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code]
- .asInt())) {
-
+void PolicyEventObserver::ProcessOdometerEvent(
+ const smart_objects::SmartObject& message) {
+ if (hmi_apis::Common_Result::SUCCESS ==
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].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 8732a122c5..cf312acc6d 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -29,9 +29,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "application_manager/policies/policy_handler.h"
-
#include <unistd.h>
#include <dlfcn.h>
#include <algorithm>
@@ -40,7 +38,8 @@
#include "application_manager/policies/delegates/app_permission_delegate.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "policy/policy_manager_impl.h"
#include "connection_handler/connection_handler.h"
@@ -48,16 +47,19 @@
#include "utils/date_time.h"
#include "json/value.h"
#include "json/writer.h"
-#include "config_profile/profile.h"
#include "application_manager/usage_statistics.h"
#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;
@@ -91,30 +93,50 @@ const std::string RequestTypeToString(RequestType::eType type) {
}
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; \
- } \
+
+#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; \
- } \
+#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; \
+ } \
}
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+static const std::string kCerficateFileName = "certificate";
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();
@@ -133,34 +155,40 @@ typedef std::set<application_manager::ApplicationSharedPtr,
struct DeactivateApplication {
explicit DeactivateApplication(
- const connection_handler::DeviceHandle &device_id)
- : device_id_(device_id) {}
+ const connection_handler::DeviceHandle& device_id,
+ StateController& state_ctrl)
+ : device_id_(device_id), state_ctrl_(state_ctrl) {}
- void operator()(const ApplicationSharedPtr &app) {
+ 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);
+ state_ctrl_.SetRegularState(app,
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ true);
}
}
-private:
+ private:
connection_handler::DeviceHandle device_id_;
+ StateController& state_ctrl_;
};
-struct SDLAlowedNotification {
- SDLAlowedNotification(const connection_handler::DeviceHandle &device_id,
- PolicyManager *policy_manager)
- : device_id_(device_id), policy_manager_(policy_manager) {}
+struct SDLAllowedNotification {
+ SDLAllowedNotification(const connection_handler::DeviceHandle& device_id,
+ PolicyManager* policy_manager,
+ StateController& state_controller)
+ : device_id_(device_id)
+ , policy_manager_(policy_manager)
+ , state_controller_(state_controller) {}
- void operator()(const ApplicationSharedPtr &app) {
+ 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);
+ policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
if ("BACKGROUND" == hmi_level) {
default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
} else if ("FULL" == hmi_level) {
@@ -172,47 +200,52 @@ struct SDLAlowedNotification {
} else {
return;
}
- ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
- default_mobile_hmi);
+ state_controller_.SetRegularState(app, default_mobile_hmi, true);
}
}
-private:
+ private:
connection_handler::DeviceHandle device_id_;
- PolicyManager *policy_manager_;
+ PolicyManager* policy_manager_;
+ StateController& state_controller_;
};
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,
+ const ApplicationManager& application_manager)
+ : app_to_device_link_(app_to_device_link)
+ , application_manager_(application_manager) {
app_to_device_link_.clear();
}
- void operator()(const ApplicationSharedPtr &app) {
+ void operator()(const ApplicationSharedPtr& app) {
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Invalid pointer to application was passed."
- "Skip current application.");
+ LOG4CXX_WARN(logger_,
+ "Invalid pointer to application was passed."
+ "Skip current application.");
return;
}
- DeviceParams device_params;
- MessageHelper::GetDeviceInfoForApp(app->app_id(), &device_params);
- const std::string app_id = app->mobile_app_id();
+ DeviceParams device_params = GetDeviceParams(
+ app->device(),
+ application_manager_.connection_handler().get_session_observer());
+ const std::string app_id = app->policy_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:
- std::map<std::string, std::string> &app_to_device_link_;
+ private:
+ std::map<std::string, std::string>& app_to_device_link_;
+ const ApplicationManager& application_manager_;
};
struct PermissionsConsolidator {
void Consolidate(
- const std::vector<policy::FunctionalGroupPermission> &permissions) {
+ const std::vector<policy::FunctionalGroupPermission>& permissions) {
std::vector<policy::FunctionalGroupPermission>::const_iterator it =
permissions.begin();
std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
@@ -220,7 +253,8 @@ struct PermissionsConsolidator {
for (; it != it_end; ++it) {
std::vector<policy::FunctionalGroupPermission>::iterator it_consolidated =
std::find(consolidated_permissions_.begin(),
- consolidated_permissions_.end(), *it);
+ consolidated_permissions_.end(),
+ *it);
// If found, consolidate states
if (consolidated_permissions_.end() != it_consolidated) {
@@ -239,23 +273,26 @@ struct PermissionsConsolidator {
}
}
- const std::vector<policy::FunctionalGroupPermission> &
+ const std::vector<policy::FunctionalGroupPermission>&
GetConsolidatedPermissions() const {
return consolidated_permissions_;
}
-private:
+ private:
std::vector<policy::FunctionalGroupPermission> consolidated_permissions_;
};
-PolicyHandler *PolicyHandler::instance_ = NULL;
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(const PolicySettings& settings,
+ ApplicationManager& application_manager)
+ : 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>(this))
+ , settings_(settings)
+ , application_manager_(application_manager) {}
PolicyHandler::~PolicyHandler() {}
@@ -263,43 +300,54 @@ 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 "
- "functionality.");
- policy_manager_ = NULL;
+ LOG4CXX_WARN(logger_,
+ "System is configured to work without policy "
+ "functionality.");
+ 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::SharedPtr<PolicyEventObserver>(new PolicyEventObserver(
+ this, application_manager_.event_dispatcher()));
}
} else {
- LOG4CXX_ERROR(logger_, error_string);
+ LOG4CXX_ERROR(logger_, error);
}
return policy_manager_.valid();
}
-bool PolicyHandler::PolicyEnabled() {
- return profile::Profile::instance()->enable_policy();
+bool PolicyHandler::PolicyEnabled() const {
+ return get_settings().enable_policy();
}
bool PolicyHandler::CreateManager() {
- typedef PolicyManager *(*CreateManager)();
+ typedef PolicyManager* (*CreateManager)();
+ typedef void (*DeleteManager)(PolicyManager*);
CreateManager create_manager =
reinterpret_cast<CreateManager>(dlsym(dl_handle_, "CreateManager"));
- char *error_string = dlerror();
- if (error_string == NULL) {
- policy_manager_ = create_manager();
+ DeleteManager delete_manager =
+ reinterpret_cast<DeleteManager>(dlsym(dl_handle_, "DeleteManager"));
+ char* error_string = dlerror();
+ if (NULL == error_string) {
+ policy_manager_ =
+ utils::SharedPtr<PolicyManager>(create_manager(), delete_manager);
} else {
LOG4CXX_WARN(logger_, error_string);
}
return policy_manager_.valid();
}
+const PolicySettings& PolicyHandler::get_settings() const {
+ return settings_;
+}
+
bool PolicyHandler::InitPolicyTable() {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
@@ -307,10 +355,9 @@ bool PolicyHandler::InitPolicyTable() {
// info necessary for policy table
event_observer_->subscribe_on_event(
hmi_apis::FunctionID::BasicCommunication_OnReady);
- std::string preloaded_file =
- profile::Profile::instance()->preloaded_pt_file();
+ const std::string& preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
- return policy_manager_->InitPT(preloaded_file);
+ return policy_manager_->InitPT(preloaded_file, &get_settings());
}
LOG4CXX_FATAL(logger_, "The file which contains preloaded PT is not exist");
return false;
@@ -319,8 +366,7 @@ bool PolicyHandler::InitPolicyTable() {
bool PolicyHandler::ResetPolicyTable() {
LOG4CXX_TRACE(logger_, "Reset policy table.");
POLICY_LIB_CHECK(false);
- std::string preloaded_file =
- profile::Profile::instance()->preloaded_pt_file();
+ const std::string& preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->ResetPT(preloaded_file);
}
@@ -334,53 +380,57 @@ bool PolicyHandler::ClearUserConsent() {
return policy_manager_->ResetUserConsent();
}
-uint32_t PolicyHandler::GetAppIdForSending() {
- ApplicationManagerImpl::ApplicationListAccessor accessor;
+uint32_t PolicyHandler::GetAppIdForSending() const {
+ POLICY_LIB_CHECK(0);
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
HmiLevelOrderedApplicationList app_list(accessor.begin(), accessor.end());
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(),
+ application_manager_.connection_handler().get_session_observer());
+
if (kDeviceAllowed ==
policy_manager_->GetUserConsentForDevice(
- device_param.device_mac_address)) {
+ device_params.device_mac_address)) {
return app_id;
}
}
}
-
return 0;
}
void PolicyHandler::OnAppPermissionConsent(
- const uint32_t connection_key, const PermissionConsent &permissions) {
+ const uint32_t connection_key, const PermissionConsent& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
- AsyncRun(new AppPermissionDelegate(connection_key, permissions));
+ AsyncRun(new AppPermissionDelegate(connection_key, permissions, *this));
}
-void PolicyHandler::OnDeviceConsentChanged(const std::string &device_id,
- bool is_allowed) {
+void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
+ const bool is_allowed) {
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
- ApplicationManagerImpl::instance()->connection_handler()->GetDeviceID(
- device_id, &device_handle);
+ application_manager_.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();
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ 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)->policy_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
@@ -396,48 +446,71 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string &device_id,
}
}
+void PolicyHandler::SendOnAppPermissionsChanged(
+ const AppPermissions& permissions, const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "PolicyHandler::SendOnAppPermissionsChanged for "
+ << policy_app_id);
+ ApplicationSharedPtr app =
+ application_manager_.application_by_policy_id(policy_app_id);
+ if (!app.valid()) {
+ LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id);
+ return;
+ }
+ MessageHelper::SendOnAppPermissionsChangedNotification(
+ app->app_id(), permissions, application_manager_);
+}
+
void PolicyHandler::OnPTExchangeNeeded() {
POLICY_LIB_CHECK_VOID();
- policy_manager_->ForcePTExchange();
+ MessageHelper::SendOnStatusUpdate(policy_manager_->ForcePTExchange(),
+ application_manager_);
}
-void PolicyHandler::GetAvailableApps(std::queue<std::string> &apps) {
+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 =
+ application_manager_.applications().GetData();
+ ApplicationSetConstIt iter = app_list.begin();
for (; app_list.end() != iter; ++iter) {
LOG4CXX_INFO(logger_, "one more app");
- apps.push((*iter)->mobile_app_id());
+ apps.push((*iter)->policy_app_id());
}
}
-void PolicyHandler::AddApplication(const std::string &application_id) {
+void PolicyHandler::AddApplication(const std::string& application_id) {
POLICY_LIB_CHECK_VOID();
policy_manager_->AddApplication(application_id);
}
-void PolicyHandler::SetDeviceInfo(std::string &device_id,
- const DeviceInfo &device_info) {
+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(const std::string& device_id,
+ const DeviceInfo& device_info) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetDeviceInfo(device_id, device_info);
}
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);
+ ApplicationSharedPtr app = application_manager_.application(connection_key);
if (app.valid()) {
- permissions.policy_app_id = app->mobile_app_id();
- policy::DeviceParams device_params;
- MessageHelper::GetDeviceInfoForHandle(app->device(), &device_params);
+ permissions.policy_app_id = app->policy_app_id();
+ DeviceParams device_params = GetDeviceParams(
+ app->device(),
+ application_manager_.connection_handler().get_session_observer());
permissions.device_id = device_params.device_mac_address;
}
@@ -451,8 +524,9 @@ 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 "
- "setting common permissions.");
+ LOG4CXX_WARN(logger_,
+ "There are no applications previously stored for "
+ "setting common permissions.");
return;
}
@@ -462,22 +536,25 @@ void PolicyHandler::OnAppPermissionConsentInternal(
app_to_device_link_.end();
for (; it != it_end; ++it) {
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application_by_policy_id(it->first);
+ application_manager_.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."
- "Permissions setting skipped.");
+ 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(),
+ application_manager_.connection_handler().get_session_observer());
if (device_params.device_mac_address != it->second) {
- LOG4CXX_WARN(logger_, "Device_id of application is changed."
- "Permissions setting skipped.");
+ LOG4CXX_WARN(logger_,
+ "Device_id of application is changed."
+ "Permissions setting skipped.");
continue;
}
@@ -487,15 +564,32 @@ 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,
+ 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);
// Send response to HMI with gathered data
- MessageHelper::SendGetUserFriendlyMessageResponse(result, correlation_id);
+ MessageHelper::SendGetUserFriendlyMessageResponse(
+ result, correlation_id, application_manager_);
}
void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
@@ -506,10 +600,11 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
// applications
if (!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();
+ LinkAppToDevice linker(app_to_device_link_, application_manager_);
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ 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);
@@ -519,31 +614,35 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
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);
+ policy_manager_->GetUserConsentForApp(
+ it->second, it->first, group_permissions);
consolidator.Consolidate(group_permissions);
}
MessageHelper::SendGetListOfPermissionsResponse(
- consolidator.GetConsolidatedPermissions(), correlation_id);
+ consolidator.GetConsolidatedPermissions(),
+ correlation_id,
+ application_manager_);
return;
}
// Single app only
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key);
+ ApplicationSharedPtr app = application_manager_.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(),
+ application_manager_.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.");
@@ -551,11 +650,11 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
LOG4CXX_WARN(logger_, "Couldn't find application to get permissions.");
} else {
policy_manager_->GetUserConsentForApp(device_params.device_mac_address,
- app->mobile_app_id(),
+ app->policy_app_id(),
group_permissions);
- MessageHelper::SendGetListOfPermissionsResponse(group_permissions,
- correlation_id);
+ MessageHelper::SendGetListOfPermissionsResponse(
+ group_permissions, correlation_id, application_manager_);
}
}
@@ -563,42 +662,46 @@ 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,
+ application_manager_);
}
-void PolicyHandler::OnUpdateStatusChanged(const std::string &status) {
+void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
LOG4CXX_AUTO_TRACE(logger_);
- MessageHelper::SendOnStatusUpdate(status);
+ MessageHelper::SendOnStatusUpdate(status, application_manager_);
}
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);
+ application_manager_.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(),
+ application_manager_.connection_handler().get_session_observer());
+
+ return device_params.device_mac_address;
}
-void PolicyHandler::OnSystemInfoChanged(const std::string &language) {
+void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemLanguage(language);
}
-void PolicyHandler::OnGetSystemInfo(const std::string &ccpu_version,
- const std::string &wers_country_code,
- const std::string &language) {
+void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
@@ -607,35 +710,37 @@ void PolicyHandler::OnGetSystemInfo(const std::string &ccpu_version,
void PolicyHandler::OnSystemInfoUpdateRequired() {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
- MessageHelper::SendGetSystemInfoRequest();
+ MessageHelper::SendGetSystemInfoRequest(application_manager_);
}
void PolicyHandler::OnVIIsReady() {
+ LOG4CXX_AUTO_TRACE(logger_);
const uint32_t correlation_id =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ application_manager_.GetNextHMICorrelationID();
std::vector<std::string> params;
params.push_back(strings::vin);
- MessageHelper::CreateGetVehicleDataRequest(correlation_id, params);
+ MessageHelper::CreateGetVehicleDataRequest(
+ correlation_id, params, application_manager_);
}
void PolicyHandler::OnVehicleDataUpdated(
- const smart_objects::SmartObject &message) {
+ const smart_objects::SmartObject& message) {
POLICY_LIB_CHECK_VOID();
}
void PolicyHandler::OnPendingPermissionChange(
- const std::string &policy_app_id) {
- LOG4CXX_DEBUG(logger_, "PolicyHandler::OnPendingPermissionChange for "
- << policy_app_id);
+ const std::string& 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);
+ application_manager_.application_by_policy_id(policy_app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "No app found for " << policy_app_id
- << " policy app id.");
+ LOG4CXX_WARN(logger_,
+ "No app found for " << policy_app_id << " policy app id.");
return;
}
@@ -646,10 +751,12 @@ void PolicyHandler::OnPendingPermissionChange(
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, application_manager_);
+ application_manager_.state_controller().SetRegularState(
+ app,
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ true);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
return;
}
@@ -657,89 +764,93 @@ 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, application_manager_);
+
+ 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, application_manager_);
- 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, application_manager_);
}
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::ORIGIN_SDL);
- ApplicationManagerImpl::instance()->OnAppUnauthorized(app->app_id());
+ application_manager_.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, application_manager_);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
}
-bool PolicyHandler::SendMessageToSDK(const BinaryMessage &pt_string,
- const std::string &url) {
+bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
uint32_t app_id = GetAppIdForSending();
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(app_id);
+ ApplicationSharedPtr app = application_manager_.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();
+ const std::string& mobile_app_id = app->policy_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 "
+ "with connection key " << app_id);
- MessageHelper::SendPolicySnapshotNotification(app_id, pt_string, url, 0);
+ MessageHelper::SendPolicySnapshotNotification(
+ app_id, pt_string, url, application_manager_);
return true;
}
-bool PolicyHandler::ReceiveMessageFromSDK(const std::string &file,
- const BinaryMessage &pt_string) {
+bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
+ const BinaryMessage& pt_string) {
POLICY_LIB_CHECK(false);
bool ret = policy_manager_->LoadPT(file, pt_string);
@@ -747,8 +858,9 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string &file,
if (ret) {
LOG4CXX_INFO(logger_, "PTU was successful.");
policy_manager_->CleanupUnpairedDevices();
- int32_t correlation_id =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ int32_t correlation_id = application_manager_.GetNextHMICorrelationID();
+
+ SetDaysAfterEpoch();
event_observer_->subscribe_on_event(
#ifdef HMI_DBUS_API
@@ -759,8 +871,8 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string &file,
);
std::vector<std::string> vehicle_data_args;
vehicle_data_args.push_back(strings::odometer);
- MessageHelper::CreateGetVehicleDataRequest(correlation_id,
- vehicle_data_args);
+ MessageHelper::CreateGetVehicleDataRequest(
+ correlation_id, vehicle_data_args, application_manager_);
} else {
LOG4CXX_WARN(logger_, "Exchange wasn't successful, trying another one.");
OnPTExchangeNeeded();
@@ -785,54 +897,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();
+ using namespace mobile_apis;
// 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_.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();
+ 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 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.");
+ 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) {
- DeviceHandles::iterator it =
- std::find(pending_device_handles_.begin(),
- pending_device_handles_.end(), 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_handle);
// If consent done from HMI menu
if (it == pending_device_handles_.end()) {
return;
@@ -851,14 +959,13 @@ void PolicyHandler::OnIgnitionCycleOver() {
void PolicyHandler::OnActivateApp(uint32_t connection_key,
uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(connection_key);
+ POLICY_LIB_CHECK_VOID();
+ ApplicationSharedPtr app = application_manager_.application(connection_key);
if (!app.valid()) {
LOG4CXX_WARN(logger_, "Activated App failed: no app found.");
return;
}
- std::string policy_app_id = app->mobile_app_id();
+ std::string policy_app_id = app->policy_app_id();
AppPermissions permissions(policy_app_id);
@@ -878,19 +985,20 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
// 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)) {
+ if (application_manager_.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);
+ MessageHelper::SendSDLActivateAppResponse(
+ permissions, correlation_id, application_manager_);
}
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);
}
@@ -899,21 +1007,22 @@ 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, application_manager_);
}
-void PolicyHandler::OnPermissionsUpdated(const std::string &policy_app_id,
- const Permissions &permissions,
- const HMILevel &default_hmi) {
+void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions,
+ const HMILevel& default_hmi) {
LOG4CXX_AUTO_TRACE(logger_);
OnPermissionsUpdated(policy_app_id, permissions);
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application_by_policy_id(
- policy_app_id);
+ application_manager_.application_by_policy_id(policy_app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Connection_key not found for application_id:"
- << policy_app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
return;
}
@@ -924,8 +1033,9 @@ void PolicyHandler::OnPermissionsUpdated(const std::string &policy_app_id,
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) {
@@ -933,50 +1043,56 @@ void PolicyHandler::OnPermissionsUpdated(const std::string &policy_app_id,
return;
}
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);
- break;
- }
- default:
- LOG4CXX_WARN(logger_, "Application " << policy_app_id
- << " is running."
- "HMI level won't be changed.");
- break;
+ case mobile_apis::HMILevel::HMI_NONE: {
+ 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) {
+ application_manager_.state_controller().SetRegularState(
+ app, hmi_level, true);
+ } else {
+ application_manager_.state_controller().SetRegularState(
+ app, hmi_level, false);
+ }
+ break;
+ }
+ default:
+ LOG4CXX_WARN(logger_,
+ "Application " << policy_app_id
+ << " is running."
+ "HMI level won't be changed.");
+ break;
}
}
-void PolicyHandler::OnPermissionsUpdated(const std::string &policy_app_id,
- const Permissions &permissions) {
+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);
+ application_manager_.application_by_policy_id(policy_app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Connection_key not found for application_id:"
- << policy_app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
return;
}
- MessageHelper::SendOnPermissionsChangeNotification(app->app_id(),
- permissions);
+ MessageHelper::SendOnPermissionsChangeNotification(
+ app->app_id(), permissions, application_manager_);
- LOG4CXX_DEBUG(logger_, "Notification sent for application_id:"
- << policy_app_id << " and connection_key "
- << app->app_id());
+ LOG4CXX_DEBUG(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();
+bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string,
+ std::string& snap_path) {
+ const std::string& policy_snapshot_file_name =
+ settings_.policies_snapshot_file_name();
+ const std::string& system_files_path = settings_.system_files_path();
snap_path = system_files_path + '/' + policy_snapshot_file_name;
bool result = false;
@@ -991,7 +1107,7 @@ bool PolicyHandler::SaveSnapshot(const BinaryMessage &pt_string,
return result;
}
-void PolicyHandler::OnSnapshotCreated(const BinaryMessage &pt_string) {
+void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
#ifdef EXTENDED_POLICY
@@ -1000,58 +1116,65 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage &pt_string) {
LOG4CXX_ERROR(logger_, "Snapshot processing skipped.");
return;
}
- MessageHelper::SendPolicyUpdate(
- policy_snapshot_full_path, policy_manager_->TimeoutExchange(),
- policy_manager_->RetrySequenceDelaysSeconds());
+ MessageHelper::SendPolicyUpdate(policy_snapshot_full_path,
+ policy_manager_->TimeoutExchange(),
+ policy_manager_->RetrySequenceDelaysSeconds(),
+ application_manager_);
#else
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());
#endif
}
-bool PolicyHandler::GetPriority(const std::string &policy_app_id,
- std::string *priority) {
+bool PolicyHandler::GetPriority(const std::string& policy_app_id,
+ std::string* priority) const {
POLICY_LIB_CHECK(false);
return policy_manager_->GetPriority(policy_app_id, priority);
}
-void PolicyHandler::CheckPermissions(const PTString &app_id,
- const PTString &hmi_level,
- const PTString &rpc,
- const RPCParams &rpc_params,
- CheckPermissionResult &result) {
+void PolicyHandler::CheckPermissions(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result) {
POLICY_LIB_CHECK_VOID();
policy_manager_->CheckPermissions(app_id, hmi_level, rpc, rpc_params, result);
}
-uint32_t PolicyHandler::GetNotificationsNumber(const std::string &priority) {
+uint32_t PolicyHandler::GetNotificationsNumber(
+ const std::string& priority) const {
POLICY_LIB_CHECK(0);
return policy_manager_->GetNotificationsNumber(priority);
}
-DeviceConsent
-PolicyHandler::GetUserConsentForDevice(const std::string &device_id) {
+DeviceConsent PolicyHandler::GetUserConsentForDevice(
+ const std::string& device_id) const {
POLICY_LIB_CHECK(kDeviceDisallowed);
return policy_manager_->GetUserConsentForDevice(device_id);
}
-bool PolicyHandler::GetDefaultHmi(const std::string &policy_app_id,
- std::string *default_hmi) {
+bool PolicyHandler::GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi) const {
POLICY_LIB_CHECK(false);
return policy_manager_->GetDefaultHmi(policy_app_id, default_hmi);
}
-bool PolicyHandler::GetInitialAppData(const std::string &application_id,
- StringArray *nicknames,
- StringArray *app_hmi_types) {
+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);
}
@@ -1086,67 +1209,74 @@ 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) {
+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) {
+void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) {
+ if (NULL == listener) {
+ return;
+ }
sync_primitives::AutoLock lock(listeners_lock_);
listeners_.remove(listener);
}
utils::SharedPtr<usage_statistics::StatisticsManager>
-PolicyHandler::GetStatisticManager() {
+PolicyHandler::GetStatisticManager() const {
return statistic_manager_impl_;
}
void PolicyHandler::AddStatisticsInfo(int type) {
POLICY_LIB_CHECK_VOID();
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);
- ++count_of_iap_buffer_full;
- break;
- }
- default: { LOG4CXX_WARN(logger_, "Type of statistics is unknown"); }
+ case hmi_apis::Common_StatisticsType::iAPP_BUFFER_FULL: {
+ usage_statistics::GlobalCounter count_of_iap_buffer_full(
+ GetStatisticManager(), usage_statistics::IAP_BUFFER_FULL);
+ ++count_of_iap_buffer_full;
+ break;
+ }
+ default: { LOG4CXX_WARN(logger_, "Type of statistics is unknown"); }
}
}
void PolicyHandler::OnSystemError(int code) {
POLICY_LIB_CHECK_VOID();
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);
- ++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);
- ++count_sync_out_of_memory;
- break;
- }
- default: { LOG4CXX_WARN(logger_, "System error is unknown"); }
+ case hmi_apis::Common_SystemError::SYNC_REBOOTED: {
+ usage_statistics::GlobalCounter count_of_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);
+ ++count_sync_out_of_memory;
+ break;
+ }
+ 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);
+ application_manager_.application_by_policy_id(policy_app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Connection_key not found for application_id:"
- << policy_app_id);
- return "";
+ LOG4CXX_WARN(
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
+ return custom_str::CustomString("");
}
return app->name();
}
@@ -1161,26 +1291,29 @@ void PolicyHandler::OnUpdateHMIAppType(
}
}
-void PolicyHandler::OnCertificateUpdated(const std::string &certificate_data) {
+void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
HandlersCollection::const_iterator it = listeners_.begin();
for (; it != listeners_.end(); ++it) {
- (*it)->OnCertificateUpdated(certificate_data);
+ PolicyHandlerObserver* observer = *it;
+ observer->OnCertificateUpdated(certificate_data);
}
}
-bool PolicyHandler::CanUpdate() { return 0 != GetAppIdForSending(); }
+bool PolicyHandler::CanUpdate() {
+ return 0 != GetAppIdForSending();
+}
-void PolicyHandler::RemoveDevice(const std::string &device_id) {
+void PolicyHandler::RemoveDevice(const std::string& device_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->MarkUnpairedDevice(device_id);
}
-bool PolicyHandler::IsApplicationRevoked(const std::string &app_id) {
- LOG4CXX_TRACE(logger_, "PolicyHandler::IsApplicationRevoked");
+bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
return policy_manager_->IsApplicationRevoked(app_id);
@@ -1192,36 +1325,36 @@ void PolicyHandler::OnUpdateRequestSentToMobile() {
policy_manager_->OnUpdateStarted();
}
-bool PolicyHandler::CheckKeepContext(const std::string &policy_app_id) {
+bool PolicyHandler::CheckKeepContext(const std::string& policy_app_id) const {
POLICY_LIB_CHECK(false);
return policy_manager_->CanAppKeepContext(policy_app_id);
}
-bool PolicyHandler::CheckStealFocus(const std::string &policy_app_id) {
+bool PolicyHandler::CheckStealFocus(const std::string& policy_app_id) const {
POLICY_LIB_CHECK(false);
return policy_manager_->CanAppStealFocus(policy_app_id);
}
bool PolicyHandler::CheckSystemAction(
mobile_apis::SystemAction::eType system_action,
- const std::string &policy_app_id) {
+ const std::string& policy_app_id) const {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
switch (system_action) {
- case SystemAction::STEAL_FOCUS:
- return CheckStealFocus(policy_app_id);
- case SystemAction::KEEP_CONTEXT:
- return CheckKeepContext(policy_app_id);
- case SystemAction::DEFAULT_ACTION:
- return true;
- default:
- break;
+ case SystemAction::STEAL_FOCUS:
+ return CheckStealFocus(policy_app_id);
+ case SystemAction::KEEP_CONTEXT:
+ return CheckKeepContext(policy_app_id);
+ case SystemAction::DEFAULT_ACTION:
+ return true;
+ default:
+ break;
}
LOG4CXX_DEBUG(logger_, "Unknown system action");
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);
}
@@ -1243,18 +1376,18 @@ void policy::PolicyHandler::OnAppsSearchStarted() {
policy_manager_->OnAppsSearchStarted();
}
-void policy::PolicyHandler::OnAppsSearchCompleted() {
+void PolicyHandler::OnAppsSearchCompleted() {
POLICY_LIB_CHECK();
policy_manager_->OnAppsSearchCompleted();
}
-void PolicyHandler::OnAppRegisteredOnMobile(const std::string &application_id) {
+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,
+ const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const {
POLICY_LIB_CHECK(false);
using namespace mobile_apis;
@@ -1278,35 +1411,40 @@ bool PolicyHandler::IsRequestTypeAllowed(
return request_types.end() != it;
}
-const std::vector<std::string>
-PolicyHandler::GetAppRequestTypes(const std::string &policy_app_id) const {
+const std::vector<std::string> PolicyHandler::GetAppRequestTypes(
+ const std::string& policy_app_id) const {
POLICY_LIB_CHECK(std::vector<std::string>());
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,
+void PolicyHandler::Increment(const std::string& app_id,
usage_statistics::AppCounterId type) {
POLICY_LIB_CHECK();
policy_manager_->Increment(app_id, type);
}
-void PolicyHandler::Set(const std::string &app_id,
+void PolicyHandler::Set(const std::string& app_id,
usage_statistics::AppInfoId type,
- const std::string &value) {
+ const std::string& value) {
POLICY_LIB_CHECK();
policy_manager_->Set(app_id, type, value);
}
-void PolicyHandler::Add(const std::string &app_id,
+void PolicyHandler::Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) {
POLICY_LIB_CHECK();
policy_manager_->Add(app_id, type, timespan_seconds);
}
-} // namespace policy
+} // namespace policy
diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc
index e1b47a0d96..a88aef0cc1 100644
--- a/src/components/application_manager/src/policies/policy_retry_sequence.cc
+++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc
@@ -42,8 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
RetrySequence::RetrySequence(PolicyHandler* const policy_handler)
// TODO (Risk copy of PolicyHandler Pointer)
- : policy_handler_(policy_handler) {
-}
+ : policy_handler_(policy_handler) {}
void RetrySequence::threadMain() {
StartNextRetry();
@@ -54,8 +53,7 @@ void RetrySequence::StartNextRetry() {
DCHECK(policy_handler_);
// TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib
- BinaryMessageSptr pt_snapshot = policy_handler_
- ->RequestPTUpdate();
+ BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate();
if (pt_snapshot) {
policy_handler_->SendMessageToSDK(*pt_snapshot);
@@ -77,4 +75,3 @@ void RetrySequence::StartNextRetry() {
}
} // namespace policy
-
diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc b/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
index eba808f406..e1d5199063 100644
--- a/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
+++ b/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
@@ -43,38 +43,38 @@ using application_manager::MessageHelper;
using profile::Profile;
using std::string;
-
namespace policy {
CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
PTExchangeHandlerExt::PTExchangeHandlerExt(PolicyHandler* policy_handler)
- : PTExchangeHandler(),
- policy_handler_(policy_handler) {
+ : PTExchangeHandler(), policy_handler_(policy_handler) {
DCHECK(policy_handler_);
}
-PTExchangeHandlerExt::~PTExchangeHandlerExt() {
-}
+PTExchangeHandlerExt::~PTExchangeHandlerExt() {}
void PTExchangeHandlerExt::Start() {
LOG4CXX_TRACE(logger_, "Start exchange PT");
const string policy_snapshot_file_name =
- Profile::instance()->policies_snapshot_file_name();
+ policy_handler_->get_settings().policies_snapshot_file_name();
const std::string system_files_path =
- Profile::instance()->system_files_path();
- const std::string policy_snapshot_full_path = system_files_path + '/' +
- policy_snapshot_file_name;
+ policy_handler_->get_settings().system_files_path();
+ const std::string policy_snapshot_full_path =
+ system_files_path + '/' + policy_snapshot_file_name;
BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate();
if (pt_snapshot.valid()) {
if (file_system::CreateDirectoryRecursively(system_files_path) &&
file_system::WriteBinaryFile(policy_snapshot_full_path, *pt_snapshot)) {
- MessageHelper::SendPolicyUpdate(policy_snapshot_full_path,
- policy_handler_->TimeoutExchange(),
- policy_handler_->RetrySequenceDelaysSeconds());
+ MessageHelper::SendPolicyUpdate(
+ policy_snapshot_full_path,
+ policy_handler_->TimeoutExchange(),
+ policy_handler_->RetrySequenceDelaysSeconds());
} else {
- LOG4CXX_ERROR(logger_, "Failed to write snapshot file to " << policy_snapshot_file_name);
+ LOG4CXX_ERROR(logger_,
+ "Failed to write snapshot file to "
+ << policy_snapshot_file_name);
}
} else {
LOG4CXX_ERROR(logger_, "Failed to obtain policy table snapshot");
diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
index 5a01e28d6d..d1c6fafb07 100644
--- a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
+++ b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
@@ -42,8 +42,9 @@ namespace policy {
CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
PTExchangeHandlerImpl::PTExchangeHandlerImpl(PolicyHandler* handler)
- : policy_handler_(handler),
- retry_sequence_(threads::CreateThread("RetrySequence", new RetrySequence(handler))) {
+ : policy_handler_(handler)
+ , retry_sequence_(
+ threads::CreateThread("RetrySequence", new RetrySequence(handler))) {
DCHECK(policy_handler_);
LOG4CXX_INFO(logger_, "Exchan created");
}
@@ -59,7 +60,8 @@ void PTExchangeHandlerImpl::Start() {
retry_sequence_->stop();
threads::DeleteThread(retry_sequence_);
- retry_sequence_ = threads::CreateThread("RetrySequence", new RetrySequence(policy_handler_));
+ retry_sequence_ = threads::CreateThread("RetrySequence",
+ new RetrySequence(policy_handler_));
if (policy_handler_) {
policy_handler_->ResetRetrySequence();
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index 098a55fa73..b2ced9b01b 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.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
@@ -31,11 +31,12 @@
*/
#include "utils/logger.h"
-#include "config_profile/profile.h"
+
#include "application_manager/request_controller.h"
#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,18 @@ 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) {
+RequestController::RequestController(const RequestControlerSettings& settings)
+ : pool_state_(UNDEFINED)
+ , pool_size_(settings.thread_pool_size())
+ , timer_("AM RequestCtrlTimer",
+ new timer::TimerTaskImpl<RequestController>(
+ this, &RequestController::onTimer))
+ , is_low_voltage_(false)
+ , settings_(settings) {
LOG4CXX_AUTO_TRACE(logger_);
InitializeThreadpool();
- timer_.start(dafault_sleep_time_);
}
RequestController::~RequestController() {
@@ -68,7 +71,7 @@ void RequestController::InitializeThreadpool() {
pool_state_ = TPoolState::STARTED;
char name[50];
for (uint32_t i = 0; i < pool_size_; i++) {
- snprintf(name, sizeof(name)/sizeof(name[0]), "AM Pool %d", i);
+ snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %d", i);
pool_.push_back(threads::CreateThread(name, new Worker(this)));
pool_[i]->start();
LOG4CXX_DEBUG(logger_, "Request thread initialized: " << name);
@@ -78,7 +81,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
@@ -92,24 +95,22 @@ void RequestController::DestroyThreadpool() {
pool_.clear();
}
-RequestController::TResult RequestController::CheckPosibilitytoAdd(
+RequestController::TResult RequestController::CheckPosibilitytoAdd(
const RequestPtr request) {
LOG4CXX_AUTO_TRACE(logger_);
const uint32_t& app_hmi_level_none_time_scale =
- profile::Profile::instance()->app_hmi_level_none_time_scale();
+ settings_.app_hmi_level_none_time_scale();
// app_hmi_level_none_max_request_per_time_scale
const uint32_t& hmi_level_none_count =
- profile::Profile::instance()->app_hmi_level_none_time_scale_max_requests();
+ settings_.app_hmi_level_none_time_scale_max_requests();
- const uint32_t& app_time_scale =
- profile::Profile::instance()->app_time_scale();
+ const uint32_t& app_time_scale = settings_.app_time_scale();
const uint32_t& max_request_per_time_scale =
- profile::Profile::instance()->app_time_scale_max_requests();
+ settings_.app_time_scale_max_requests();
- const uint32_t& pending_requests_amount =
- profile::Profile::instance()->pending_requests_amount();
+ const uint32_t& pending_requests_amount = settings_.pending_requests_amount();
if (!CheckPendingRequestsAmount(pending_requests_amount)) {
LOG4CXX_ERROR(logger_, "Too many pending request");
@@ -117,16 +118,17 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd(
}
if (!waiting_for_response_.CheckHMILevelTimeScaleMaxRequest(
- mobile_apis::HMILevel::HMI_NONE,
- request->connection_key(),
- app_hmi_level_none_time_scale,
- hmi_level_none_count)) {
+ mobile_apis::HMILevel::HMI_NONE,
+ request->connection_key(),
+ app_hmi_level_none_time_scale,
+ hmi_level_none_count)) {
LOG4CXX_ERROR(logger_, "Too many application requests in hmi level NONE");
return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS;
}
- if (!waiting_for_response_.CheckTimeScaleMaxRequest(request->connection_key(),
- app_time_scale,
- max_request_per_time_scale)) {
+ if (!waiting_for_response_.CheckTimeScaleMaxRequest(
+ request->connection_key(),
+ app_time_scale,
+ max_request_per_time_scale)) {
LOG4CXX_ERROR(logger_, "Too many application requests");
return RequestController::TOO_MANY_REQUESTS;
}
@@ -137,12 +139,14 @@ 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) {
- LOG4CXX_WARN(logger_, "Pending requests count " << pending_requests_size
- << " exceed application limit " << pending_requests_amount);
+ LOG4CXX_WARN(logger_,
+ "Pending requests count " << pending_requests_size
+ << " exceed application limit "
+ << pending_requests_amount);
}
return available_to_add;
}
@@ -151,27 +155,24 @@ bool RequestController::CheckPendingRequestsAmount(
}
RequestController::TResult RequestController::addMobileRequest(
- const RequestPtr request,
- const mobile_apis::HMILevel::eType& hmi_level) {
+ const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) {
LOG4CXX_AUTO_TRACE(logger_);
if (!request) {
LOG4CXX_ERROR(logger_, "Null Pointer request");
cond_var_.NotifyOne();
return INVALID_DATA;
}
- LOG4CXX_DEBUG(logger_, "correlation_id : " << request->correlation_id()
- << "connection_key : " << request->connection_key());
+ LOG4CXX_DEBUG(
+ logger_,
+ "correlation_id : " << request->correlation_id()
+ << "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);
- LOG4CXX_DEBUG(logger_, "Waiting for execution: "
- << mobile_request_info_list_.size());
- // wake up one thread that is waiting for a task to be available
+ if (SUCCESS == result) {
+ AutoLock auto_lock_list(mobile_request_list_lock_);
+ mobile_request_list_.push_back(request);
+ LOG4CXX_DEBUG(logger_,
+ "Waiting for execution: " << mobile_request_list_.size());
+ // wake up one thread that is waiting for a task to be available
}
cond_var_.NotifyOne();
return result;
@@ -187,19 +188,20 @@ 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;
- RequestInfoPtr request_info_ptr(new HMIRequestInfo(request,
- timeout_in_seconds));
+ const uint64_t timeout_in_mseconds =
+ static_cast<uint64_t>(request->default_timeout());
+ RequestInfoPtr request_info_ptr =
+ utils::MakeShared<HMIRequestInfo>(request, 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."
- "RequestController will not track timeout of this request.");
+ 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;
}
@@ -213,7 +215,7 @@ void RequestController::removeNotification(
const commands::Command* notification) {
LOG4CXX_AUTO_TRACE(logger_);
std::list<RequestPtr>::iterator it = notification_list_.begin();
- for (; notification_list_.end() != it; ) {
+ for (; notification_list_.end() != it;) {
if (it->get() == notification) {
notification_list_.erase(it++);
LOG4CXX_DEBUG(logger_, "Notification removed");
@@ -225,18 +227,18 @@ void RequestController::removeNotification(
LOG4CXX_DEBUG(logger_, "Cant find notification");
}
-void RequestController::terminateRequest(
- const uint32_t& correlation_id,
- const uint32_t& connection_key, bool force_terminate) {
+void RequestController::terminateRequest(const uint32_t& correlation_id,
+ const uint32_t& connection_key,
+ bool force_terminate) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "correlation_id = " << correlation_id
- << " connection_key = " << connection_key
- << " force_terminate = " << force_terminate);
- RequestInfoPtr request = waiting_for_response_.Find(connection_key,
- correlation_id);
+ LOG4CXX_DEBUG(logger_,
+ "correlation_id = "
+ << correlation_id << " connection_key = " << connection_key
+ << " force_terminate = " << force_terminate);
+ RequestInfoPtr request =
+ waiting_for_response_.Find(connection_key, correlation_id);
if (request) {
- if (force_terminate ||
- request->request()->AllowedToTerminate()) {
+ if (force_terminate || request->request()->AllowedToTerminate()) {
waiting_for_response_.RemoveRequest(request);
} else {
LOG4CXX_WARN(logger_, "Request was not terminated");
@@ -247,14 +249,13 @@ void RequestController::terminateRequest(
}
}
-void RequestController::OnMobileResponse(
- const uint32_t& mobile_correlation_id,
- const uint32_t& connection_key) {
+void RequestController::OnMobileResponse(const uint32_t& mobile_correlation_id,
+ const uint32_t& connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
terminateRequest(mobile_correlation_id, connection_key);
}
-void RequestController::OnHMIResponse(const uint32_t &correlation_id) {
+void RequestController::OnHMIResponse(const uint32_t& correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
terminateRequest(correlation_id, RequestInfo::HmiConnectoinKey);
}
@@ -262,40 +263,39 @@ void RequestController::OnHMIResponse(const uint32_t &correlation_id) {
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++);
+ LOG4CXX_DEBUG(logger_,
+ "app_id: " << app_id << "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());
+ LOG4CXX_DEBUG(logger_,
+ "Waiting for execution " << mobile_request_list_.size());
}
void RequestController::terminateWaitingForResponseAppRequests(
const uint32_t& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
waiting_for_response_.RemoveByConnectionKey(app_id);
- LOG4CXX_DEBUG(logger_, "Waiting for response count : "
- << waiting_for_response_.Size());
+ LOG4CXX_DEBUG(
+ logger_, "Waiting for response count : " << waiting_for_response_.Size());
}
-void RequestController::terminateAppRequests(
- const uint32_t& app_id) {
+void RequestController::terminateAppRequests(const uint32_t& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "app_id : " << app_id
- << "Requests waiting for execution count : "
- << mobile_request_info_list_.size()
- << "Requests waiting for response count : "
- << waiting_for_response_.Size());
+ LOG4CXX_DEBUG(logger_,
+ "app_id : " << app_id
+ << "Requests waiting for execution count : "
+ << mobile_request_list_.size()
+ << "Requests waiting for response count : "
+ << waiting_for_response_.Size());
terminateWaitingForExecutionAppRequests(app_id);
terminateWaitingForResponseAppRequests(app_id);
@@ -311,39 +311,41 @@ 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();
}
-void RequestController::updateRequestTimeout(
- const uint32_t& app_id,
- const uint32_t& correlation_id,
- const uint32_t& new_timeout) {
+void RequestController::updateRequestTimeout(const uint32_t& app_id,
+ 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");
+
+ 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);
+ LOG4CXX_INFO(logger_,
+ "Timeout updated for "
+ << " 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);
+ LOG4CXX_ERROR(logger_,
+ "Can't find request with "
+ << " app_id: " << app_id
+ << " correlation_id: " << correlation_id);
}
}
@@ -367,25 +369,28 @@ bool RequestController::IsLowVoltage() {
void RequestController::onTimer() {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ENTER Waiting fore response count: "
- << waiting_for_response_.Size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "ENTER Waiting fore response count: " << waiting_for_response_.Size());
RequestInfoPtr probably_expired =
waiting_for_response_.FrontWithNotNullTimeout();
while (probably_expired && probably_expired->isExpired()) {
- LOG4CXX_INFO(logger_, "Timeout for "
- << (RequestInfo::HMIRequest
- == probably_expired ->requst_type() ? "HMI": "Mobile")
- << " request id: "
- << probably_expired ->requestId()
- << " connection_key: " <<
- probably_expired ->app_id() << " is expired");
+ LOG4CXX_INFO(logger_,
+ "Timeout for "
+ << (RequestInfo::HMIRequest ==
+ probably_expired->requst_type()
+ ? "HMI"
+ : "Mobile")
+ << " request id: " << probably_expired->requestId()
+ << " connection_key: " << probably_expired->app_id()
+ << " is expired");
const uint32_t experied_request_id = probably_expired->requestId();
const uint32_t experied_app_id = probably_expired->app_id();
probably_expired->request()->onTimeOut();
- if (RequestInfo::HmiConnectoinKey == probably_expired ->app_id()) {
- LOG4CXX_DEBUG(logger_, "Erase HMI request: "
- << probably_expired ->requestId());
+ if (RequestInfo::HmiConnectoinKey == probably_expired->app_id()) {
+ LOG4CXX_DEBUG(logger_,
+ "Erase HMI request: " << probably_expired->requestId());
waiting_for_response_.RemoveRequest(probably_expired);
}
probably_expired = waiting_for_response_.FrontWithNotNullTimeout();
@@ -398,27 +403,25 @@ void RequestController::onTimer() {
}
}
UpdateTimer();
- LOG4CXX_DEBUG(logger_, "EXIT Waiting for response count : "
- << waiting_for_response_.Size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "EXIT Waiting for response count : " << waiting_for_response_.Size());
}
RequestController::Worker::Worker(RequestController* requestController)
- : request_controller_(requestController)
- , stop_flag_(false) {
-}
+ : request_controller_(requestController), stop_flag_(false) {}
-RequestController::Worker::~Worker() {
-}
+RequestController::Worker::~Worker() {}
void RequestController::Worker::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
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,29 +434,29 @@ 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
- // default timeout
+ 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 =
+ utils::MakeShared<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. "
+ LOG4CXX_DEBUG(logger_,
+ "Default timeout was set to 0. "
"RequestController will not track timeout "
"of this request.");
}
@@ -462,11 +465,12 @@ void RequestController::Worker::threadMain() {
// execute
if ((false == request_controller_->IsLowVoltage()) &&
- request_info_ptr->request()->CheckPermissions() && init_res) {
- LOG4CXX_DEBUG(logger_, "Execute MobileRequest corr_id = "
- << request_info_ptr->requestId()
- << " with timeout: " << timeout_in_seconds);
- request_info_ptr->request()->Run();
+ request_ptr->CheckPermissions() && init_res) {
+ LOG4CXX_DEBUG(logger_,
+ "Execute MobileRequest corr_id = "
+ << request_info_ptr->requestId()
+ << " with timeout: " << timeout_in_mseconds);
+ request_ptr->Run();
}
}
}
@@ -480,27 +484,33 @@ void RequestController::Worker::exitThreadMain() {
void RequestController::UpdateTimer() {
LOG4CXX_AUTO_TRACE(logger_);
RequestInfoPtr front = waiting_for_response_.FrontWithNotNullTimeout();
+ // Buffer for sending request
+ const uint32_t delay_time = 100u;
if (front) {
const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- const TimevalStruct end_time = front->end_time();
+ TimevalStruct end_time = front->end_time();
+ date_time::DateTime::AddMilliseconds(end_time, delay_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);
}
- } else {
- LOG4CXX_DEBUG(logger_, "Sleep for default sleep time "
- << dafault_sleep_time_ << " secs");
- timer_.updateTimeOut(dafault_sleep_time_);
}
}
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index 2b2dae443b..1826e67a0d 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -40,52 +40,47 @@ 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) {
- correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectoinKey;
+HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec)
+ : RequestInfo(request, HMIRequest, timeout_msec) {
+ correlation_id_ = request_->correlation_id();
+ app_id_ = RequestInfo::HmiConnectoinKey;
}
-HMIRequestInfo::HMIRequestInfo(
- RequestPtr request,
- const TimevalStruct &start_time,
- const uint64_t timeout_sec):
- RequestInfo(request, HMIRequest, start_time, timeout_sec) {
- correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectoinKey;
+HMIRequestInfo::HMIRequestInfo(RequestPtr request,
+ const TimevalStruct& start_time,
+ 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) {
- correlation_id_ = request_.get()->correlation_id();
- app_id_ = request_.get()->connection_key();
+MobileRequestInfo::MobileRequestInfo(RequestPtr request,
+ const uint64_t timeout_msec)
+ : RequestInfo(request, MobileRequest, timeout_msec) {
+ correlation_id_ = request_.get()->correlation_id();
+ app_id_ = request_.get()->connection_key();
}
-MobileRequestInfo::MobileRequestInfo(
- RequestPtr request,
- const TimevalStruct &start_time,
- const uint64_t timeout_sec):
- RequestInfo(request, MobileRequest, start_time, timeout_sec) {
- correlation_id_ = request_.get()->correlation_id();
- app_id_ = request_.get()->connection_key();
+MobileRequestInfo::MobileRequestInfo(RequestPtr request,
+ const TimevalStruct& start_time,
+ const uint64_t timeout_msec)
+ : RequestInfo(request, MobileRequest, start_time, timeout_msec) {
+ correlation_id_ = request_.get()->correlation_id();
+ app_id_ = request_.get()->connection_key();
}
RequestInfo::RequestInfo(RequestPtr request,
const RequestInfo::RequestType requst_type,
const TimevalStruct& start_time,
- const uint64_t timeout_sec):
- request_(request),
- start_time_(start_time),
- timeout_sec_(timeout_sec),
- hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) {
+ const uint64_t timeout_msec)
+ : request_(request)
+ , start_time_(start_time)
+ , timeout_msec_(timeout_msec)
+ , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) {
updateEndTime();
requst_type_ = requst_type;
correlation_id_ = request_->correlation_id();
@@ -94,23 +89,18 @@ 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() {
@@ -121,7 +111,7 @@ uint64_t RequestInfo::GenerateHash(uint32_t var1, uint32_t var2) {
uint64_t hash_result = 0;
hash_result = var1;
hash_result = hash_result << 32;
- hash_result = hash_result | var2;
+ hash_result = hash_result | var2;
return hash_result;
}
@@ -132,8 +122,10 @@ FakeRequestInfo::FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id) {
bool RequestInfoSet::Add(RequestInfoPtr request_info) {
DCHECK_OR_RETURN(request_info, false);
- LOG4CXX_DEBUG(logger_, "Add request app_id = " << request_info->app_id()
- << "; corr_id = " << request_info->requestId());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Add request app_id = " << request_info->app_id()
+ << "; corr_id = " << request_info->requestId());
sync_primitives::AutoLock lock(this_lock_);
CheckSetSizes();
const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt =
@@ -148,8 +140,10 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) {
CheckSetSizes();
return true;
} else {
- LOG4CXX_ERROR(logger_, "Request with app_id = " << request_info->app_id()
- << "; corr_id " << request_info->requestId() << " Already exist ");
+ LOG4CXX_ERROR(logger_,
+ "Request with app_id = "
+ << request_info->app_id() << "; corr_id "
+ << request_info->requestId() << " Already exist ");
}
CheckSetSizes();
return false;
@@ -167,7 +161,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key,
HashSortedRequestInfoSet::iterator it =
hash_sorted_pending_requests_.find(request_info_for_search);
if (it != hash_sorted_pending_requests_.end()) {
- result = *it;
+ result = *it;
}
return result;
}
@@ -190,7 +184,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;
@@ -208,8 +202,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
}
CheckSetSizes();
- size_t erased_count =
- hash_sorted_pending_requests_.erase(request_info);
+ size_t erased_count = hash_sorted_pending_requests_.erase(request_info);
DCHECK((erased_count <= 1));
if (1 == erased_count) {
TimeSortedRequestInfoSet::iterator it =
@@ -234,17 +227,17 @@ bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) {
return Erase(request_info);
}
-
-uint32_t RequestInfoSet::RemoveRequests(const RequestInfoSet::AppIdCompararator& filter) {
+uint32_t RequestInfoSet::RemoveRequests(
+ const RequestInfoSet::AppIdCompararator& filter) {
LOG4CXX_AUTO_TRACE(logger_);
uint32_t erased = 0;
sync_primitives::AutoLock lock(this_lock_);
- HashSortedRequestInfoSet::iterator it = std::find_if(
- hash_sorted_pending_requests_.begin(),
- hash_sorted_pending_requests_.end(),
- filter);
- while (it != hash_sorted_pending_requests_.end()) {
+ HashSortedRequestInfoSet::iterator it =
+ std::find_if(hash_sorted_pending_requests_.begin(),
+ hash_sorted_pending_requests_.end(),
+ filter);
+ while (it != hash_sorted_pending_requests_.end()) {
HashSortedRequestInfoSet::iterator to_erase = it++;
Erase(*to_erase);
it = std::find_if(it, hash_sorted_pending_requests_.end(), filter);
@@ -254,15 +247,16 @@ uint32_t RequestInfoSet::RemoveRequests(const RequestInfoSet::AppIdCompararator&
return erased;
}
-
uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
- return RemoveRequests(AppIdCompararator(AppIdCompararator::Equal, connection_key));
+ return RemoveRequests(
+ AppIdCompararator(AppIdCompararator::Equal, connection_key));
}
uint32_t RequestInfoSet::RemoveMobileRequests() {
LOG4CXX_AUTO_TRACE(logger_);
- return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, RequestInfo::HmiConnectoinKey));
+ return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual,
+ RequestInfo::HmiConnectoinKey));
}
const size_t RequestInfoSet::Size() {
@@ -282,8 +276,7 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest(
uint32_t app_time_scale,
uint32_t max_request_per_time_scale) {
LOG4CXX_AUTO_TRACE(logger_);
- if (max_request_per_time_scale > 0
- && app_time_scale > 0) {
+ if (max_request_per_time_scale > 0 && app_time_scale > 0) {
TimevalStruct end = date_time::DateTime::getCurrentTime();
TimevalStruct start = {0, 0};
start.tv_sec = end.tv_sec - app_time_scale;
@@ -291,10 +284,13 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest(
sync_primitives::AutoLock lock(this_lock_);
TimeScale scale(start, end, app_id);
const uint32_t count = std::count_if(time_sorted_pending_requests_.begin(),
- time_sorted_pending_requests_.end(), scale);
+ time_sorted_pending_requests_.end(),
+ scale);
if (count >= max_request_per_time_scale) {
- LOG4CXX_WARN(logger_, "Processing requests count " << count <<
- " exceed application limit " << max_request_per_time_scale);
+ LOG4CXX_WARN(logger_,
+ "Processing requests count " << count
+ << " exceed application limit "
+ << max_request_per_time_scale);
return false;
}
LOG4CXX_DEBUG(logger_, "Requests count " << count);
@@ -304,13 +300,13 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest(
return true;
}
-bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level,
+bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(
+ mobile_apis::HMILevel::eType hmi_level,
uint32_t app_id,
uint32_t app_time_scale,
uint32_t max_request_per_time_scale) {
LOG4CXX_AUTO_TRACE(logger_);
- if (max_request_per_time_scale > 0 &&
- app_time_scale > 0) {
+ if (max_request_per_time_scale > 0 && app_time_scale > 0) {
TimevalStruct end = date_time::DateTime::getCurrentTime();
TimevalStruct start = {0, 0};
start.tv_sec = end.tv_sec - app_time_scale;
@@ -318,11 +314,14 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eTy
sync_primitives::AutoLock lock(this_lock_);
HMILevelTimeScale scale(start, end, app_id, hmi_level);
const uint32_t count = std::count_if(time_sorted_pending_requests_.begin(),
- time_sorted_pending_requests_.end(), scale);
+ time_sorted_pending_requests_.end(),
+ scale);
if (count >= max_request_per_time_scale) {
- LOG4CXX_WARN(logger_, "Processing requests count " << count
- << " exceed application limit " << max_request_per_time_scale
- << " in hmi level " << hmi_level);
+ LOG4CXX_WARN(logger_,
+ "Processing requests count "
+ << count << " exceed application limit "
+ << max_request_per_time_scale << " in hmi level "
+ << hmi_level);
return false;
}
LOG4CXX_DEBUG(logger_, "Requests count " << count);
@@ -332,7 +331,8 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eTy
return true;
}
-bool RequestInfoSet::AppIdCompararator::operator()(const RequestInfoPtr value_compare) const {
+bool RequestInfoSet::AppIdCompararator::operator()(
+ const RequestInfoPtr value_compare) const {
switch (compare_type_) {
case Equal:
return value_compare->app_id() == app_id_;
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..5e24c5572c
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resume_ctrl.cc
@@ -0,0 +1,795 @@
+/*
+ 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/resumption/resume_ctrl.h"
+
+#include <fstream>
+#include <algorithm>
+
+#include "application_manager/application_manager.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 "policy/policy_manager_impl.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/state_controller.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(ApplicationManager& application_manager)
+ : event_engine::EventObserver(application_manager.event_dispatcher())
+ , 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))
+ , application_manager_(application_manager) {}
+#ifdef BUILD_TESTS
+void ResumeCtrl::set_resumption_storage(
+ utils::SharedPtr<ResumptionData> mock_storage) {
+ resumption_storage_ = mock_storage;
+}
+#endif // BUILD_TESTS
+
+bool ResumeCtrl::Init(resumption::LastState& last_state) {
+ bool use_db = application_manager_.get_settings().use_db_for_resumption();
+ if (use_db) {
+ resumption_storage_.reset(
+ new ResumptionDataDB(In_File_Storage, application_manager_));
+ 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(last_state, application_manager_));
+ if (!resumption_storage_->Init()) {
+ LOG4CXX_DEBUG(logger_, "Resumption storage initialisation failed");
+ return false;
+ }
+ }
+ LoadResumeData();
+ save_persistent_data_timer_.Start(
+ application_manager_.get_settings()
+ .app_resumption_save_persistent_data_timeout(),
+ false);
+ return true;
+}
+
+ResumeCtrl::~ResumeCtrl() {}
+
+void ResumeCtrl::SaveAllApplications() {
+ DataAccessor<ApplicationSet> accessor(application_manager_.applications());
+ 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->policy_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->policy_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 =
+ application_manager_.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 = application_manager_.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 &&
+ application_manager_.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);
+ application_manager_.state_controller().SetRegularState(application,
+ hmi_level);
+ LOG4CXX_INFO(logger_,
+ "Application with policy id " << application->policy_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->policy_app_id(), device_mac);
+}
+
+void ResumeCtrl::OnSuspend() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopSavePersistentDataTimer();
+ SaveAllApplications();
+ resumption_storage_->OnSuspend();
+ resumption_storage_->Persist();
+}
+
+void ResumeCtrl::OnAwake() {
+ ResetLaunchTime();
+ StartSavePersistentDataTimer();
+ return resumption_storage_->OnAwake();
+}
+
+void ResumeCtrl::StartSavePersistentDataTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!save_persistent_data_timer_.is_running()) {
+ save_persistent_data_timer_.Start(
+ application_manager_.get_settings()
+ .app_resumption_save_persistent_data_timeout(),
+ false);
+ }
+}
+
+void ResumeCtrl::StopSavePersistentDataTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (save_persistent_data_timer_.is_running()) {
+ 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->policy_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->policy_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->policy_app_id());
+ SetupDefaultHMILevel(application);
+ const std::string& device_mac = application->mac_address();
+ smart_objects::SmartObject saved_app;
+ bool result = resumption_storage_->GetSavedApplication(
+ application->policy_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 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->policy_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->policy_app_id());
+ RestoreAppHMIState(application);
+ RemoveApplicationFromSaved(application);
+ } else {
+ LOG4CXX_INFO(logger_,
+ "Do not need to resume application "
+ << application->policy_app_id());
+ }
+}
+
+void ResumeCtrl::ResetLaunchTime() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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->policy_app_id());
+ smart_objects::SmartObject saved_app;
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->policy_app_id(), device_mac, saved_app);
+ if (result) {
+ if (saved_app.keyExists(strings::application_commands)) {
+ if (!CheckIcons(application, saved_app[strings::application_commands])) {
+ return false;
+ }
+ }
+ if (saved_app.keyExists(strings::application_choice_sets)) {
+ 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->policy_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 (!application_manager_.get_settings().use_db_for_resumption()) {
+ resumption_storage_->Persist();
+ }
+ }
+}
+
+bool ResumeCtrl::IsDeviceMacAddressEqual(ApplicationSharedPtr application,
+ const std::string& saved_device_mac) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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->policy_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);
+ AddWayPointsSubscription(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, application_manager_.GetNextHMICorrelationID()));
+ } 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, application_manager_));
+ } 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, application_manager_));
+ } 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, application_manager_);
+ }
+}
+
+void ResumeCtrl::AddWayPointsSubscription(
+ app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::subscribed_for_way_points)) {
+ const smart_objects::SmartObject& subscribed_for_way_points_so =
+ saved_app[strings::subscribed_for_way_points];
+ if (true == subscribed_for_way_points_so.asBool()) {
+ application_manager_.SubscribeAppForWayPoints(application->app_id());
+ }
+ }
+}
+
+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, application_manager_);
+
+ 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, application_manager_));
+ }
+ }
+}
+
+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;
+ 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 "
+ << application_manager_.get_settings().resumption_delay_before_ign());
+ return sec_spent_before_ign <=
+ application_manager_.get_settings().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, application_manager_);
+ return mobile_apis::Result::INVALID_DATA != verify_images;
+}
+
+bool ResumeCtrl::CheckDelayAfterIgnOn() {
+ using namespace date_time;
+ 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 =
+ application_manager_.get_settings().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 (!application_manager_.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(const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ queue_lock_.Acquire();
+ waiting_for_timer_.push_back(app_id);
+ queue_lock_.Release();
+ LOG4CXX_DEBUG(logger_,
+ "Application ID " << app_id << " have been added"
+ " to resumption queue.");
+ if (!is_resumption_active_) {
+ is_resumption_active_ = true;
+ restore_hmi_level_timer_.Start(
+ application_manager_.get_settings().app_resuming_timeout(), true);
+ }
+}
+
+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..273cd5413e
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -0,0 +1,218 @@
+/*
+ * 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"
+#include "application_manager/application_manager_settings.h"
+
+namespace resumption {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionData::ResumptionData(
+ const application_manager::ApplicationManager& application_manager)
+ : resumption_lock_(true), application_manager_(application_manager) {}
+
+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::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..08de6d8190
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -0,0 +1,2810 @@
+/*
+ * 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/application_manager_impl.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 "application_manager/message_helper.h"
+#include "utils/helpers.h"
+#include "utils/gen_hash.h"
+#include "utils/scope_guard.h"
+#include "application_manager/application_manager_settings.h"
+
+namespace {
+const std::string kDatabaseName = "resumption";
+}
+
+namespace resumption {
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionDataDB::ResumptionDataDB(
+ DbStorage db_storage,
+ const application_manager::ApplicationManager& application_manager)
+ : ResumptionData(application_manager) {
+ if (db_storage == In_File_Storage) {
+ db_ = new utils::dbms::SQLDatabase(kDatabaseName);
+#ifndef __QNX__
+ std::string path = application_manager_.get_settings().app_storage_folder();
+ if (!path.empty()) {
+ db_->set_path(path + "/");
+ }
+ } else if (db_storage == In_Memory_Storage) {
+ db_ = new utils::dbms::SQLDatabase();
+#endif // __QNX__
+ } else {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_ERROR(logger_, "Get not existed type of database storage");
+ }
+}
+
+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 =
+ application_manager_.get_settings().attempts_to_open_resumption_db();
+ LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ bool is_opened = false;
+ const uint16_t open_attempt_timeout_ms =
+ application_manager_.get_settings()
+ .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->policy_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();
+}
+
+bool ResumptionDataDB::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ return CheckExistenceHMIId(hmi_app_id);
+}
+
+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");
+ }
+ }
+}
+
+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();
+ }
+ }
+}
+
+void ResumptionDataDB::Persist() {
+ 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;
+ std::string app_id;
+ std::string device_id;
+ while (query.Next()) {
+ app_id = query.GetString(0);
+ 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 "timeStamp" from table "application" = 7
+ // field "deviceID" from table "application" = 8
+ // field "isMediaApplication" from table "application" = 9
+ // field "IsSubscribedForWayPoints" from table "application" = 10
+ uint32_t connection_key = query.GetUInteger(1);
+
+ saved_app[strings::app_id] = query.GetString(0);
+ saved_app[strings::connection_key] = connection_key;
+ 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::time_stamp] = query.GetUInteger(7);
+ saved_app[strings::device_id] = query.GetString(8);
+ saved_app[strings::is_media_application] = query.GetBoolean(9);
+ saved_app[strings::subscribed_for_way_points] = 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;
+ bool is_subscribed_for_way_points =
+ application_manager_.IsAppSubscribedForWayPoints(connection_key);
+
+ 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 "timeStamp" from table "application" = 6
+ field "idglobalProperties" from table "application" = 7
+ field "isMediaApplication" from table "application" = 8
+ field "appID" from table "application" = 9
+ field "deviceID" from table "application" = 10
+ field "isSubscribedForWayPoints" 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, time_stamp);
+ if (global_properties_key) {
+ query.Bind(7, global_properties_key);
+ } else {
+ query.Bind(7);
+ }
+ query.Bind(8, is_media_application);
+ query.Bind(9, policy_app_id);
+ query.Bind(10, device_id);
+ query.Bind(11, is_subscribed_for_way_points);
+
+ 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..f60f934fef
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -0,0 +1,487 @@
+/*
+ * 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_manager_impl.h"
+#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 "application_manager/application_manager_settings.h"
+
+namespace resumption {
+
+namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionDataJson::ResumptionDataJson(
+ LastState& last_state,
+ const application_manager::ApplicationManager& application_manager)
+ : ResumptionData(application_manager), last_state_(last_state) {}
+
+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->policy_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();
+ const bool is_subscribed_for_way_points =
+ application_manager_.IsAppSubscribedForWayPoints(application->app_id());
+
+ 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::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;
+ json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
+
+ LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString());
+}
+
+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;
+}
+
+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;
+ 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::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());
+}
+
+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();
+ if (0 == ign_off_count) {
+ LOG4CXX_WARN(logger_, "Application has not been suspended");
+ } else {
+ (*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 {
+ 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) {
+ 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) {
+ result = true;
+ } else {
+ temp.push_back((*it));
+ }
+ }
+ }
+
+ 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& dictionary = last_state().dictionary;
+ if (!dictionary.isMember(strings::resumption)) {
+ last_state().dictionary[strings::resumption] =
+ Json::Value(Json::objectValue);
+ LOG4CXX_WARN(logger_, "resumption section is missed");
+ }
+ Json::Value& resumption = dictionary[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;
+}
+
+void ResumptionDataJson::Persist() {
+ last_state().SaveToFileSystem();
+}
+
+} // 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..5f318e6955
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -0,0 +1,981 @@
+/*
+ * 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 `subscribedForWayPoints`( "
+ " `appID` 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, "
+ " `isSubscribedForWayPoints` 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 `subscribedForWayPoints`; "
+ "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`, `isSubscribedForWayPoints`) "
+ "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`, `isSubscribedForWayPoints` "
+ "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` = ?;";
+
+const std::string kInsertSubscribedForWayPoints =
+ "INSERT INTO `subscribedForWayPoints` (`appID`) VALUES (?);";
+
+const std::string kSelectSubscribedForWayPoints =
+ "SELECT `appID` FROM `subscribedForWayPoints`;";
+
+const std::string kDeleteSubscribedForWayPoints =
+ "DELETE FROM `subscribedForWayPoints`;";
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
new file mode 100644
index 0000000000..8b8c17fc5a
--- /dev/null
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -0,0 +1,405 @@
+#include <application_manager/smart_object_keys.h>
+
+namespace application_manager {
+
+namespace strings {
+
+const char* params = "params";
+const char* message_type = "message_type";
+const char* correlation_id = "correlation_id";
+const char* function_id = "function_id";
+const char* protocol_version = "protocol_version";
+const char* protocol_type = "protocol_type";
+const char* connection_key = "connection_key";
+const char* error = "error";
+const char* error_msg = "message";
+const char* default_app_id = "default";
+const char* msg_params = "msg_params";
+const char* method_name = "methodName";
+const char* info = "info";
+const char* app_id = "appID";
+const char* hmi_app_id = "hmiAppID";
+const char* device_id = "deviceID";
+const char* subscribed_for_way_points = "subscribed_for_way_points";
+const char* url = "url";
+const char* urlScheme = "urlScheme";
+const char* packageName = "packageName";
+const char* cmd_icon = "cmdIcon";
+const char* result_code = "resultCode";
+const char* success = "success";
+const char* sync_msg_version = "syncMsgVersion";
+const char* major_version = "majorVersion";
+const char* minor_version = "minorVersion";
+const char* app_name = "appName";
+const char* ngn_media_screen_app_name = "ngnMediaScreenAppName";
+const char* vr_synonyms = "vrSynonyms";
+const char* uses_vehicle_data = "usesVehicleData";
+const char* is_media_application = "isMediaApplication";
+const char* greyOut = "greyOut";
+const char* language_desired = "languageDesired";
+const char* auto_activated_id = "autoActivateID";
+const char* app_type = "appType";
+const char* app_hmi_type = "appHMIType";
+const char* tts_name = "ttsName";
+const char* binary_data = "binary_data";
+const char* timeout_prompt = "timeoutPrompt";
+const char* timeout = "timeout";
+const char* vr_help_title = "vrHelpTitle";
+const char* vr_help = "vrHelp";
+const char* main_field_1 = "mainField1";
+const char* main_field_2 = "mainField2";
+const char* main_field_3 = "mainField3";
+const char* main_field_4 = "mainField4";
+const char* eta = "eta";
+const char* time_to_destination = "timeToDestination";
+const char* total_distance = "totalDistance";
+const char* alignment = "alignment";
+const char* graphic = "graphic";
+const char* secondary_graphic = "secondaryGraphic";
+const char* status_bar = "statusBar";
+const char* media_clock = "mediaClock";
+const char* media_track = "mediaTrack";
+const char* properties = "properties";
+const char* cmd_id = "cmdID";
+const char* menu_params = "menuParams";
+const char* menu_title = "menuTitle";
+const char* menu_icon = "menuIcon";
+const char* keyboard_properties = "keyboardProperties";
+const char* vr_commands = "vrCommands";
+const char* position = "position";
+const char* num_ticks = "numTicks";
+const char* slider_footer = "sliderFooter";
+const char* menu_id = "menuID";
+const char* menu_name = "menuName";
+const char* interaction_choice_set_id = "interactionChoiceSetID";
+const char* interaction_choice_set_id_list = "interactionChoiceSetIDList";
+const char* choice_set = "choiceSet";
+const char* choice_id = "choiceID";
+const char* grammar_id = "grammarID";
+const char* navigation_text_1 = "navigationText1";
+const char* navigation_text_2 = "navigationText2";
+const char* alert_text1 = "alertText1";
+const char* alert_text2 = "alertText2";
+const char* alert_text3 = "alertText3";
+const char* tts_chunks = "ttsChunks";
+const char* initial_prompt = "initialPrompt";
+const char* initial_text = "initialText";
+const char* duration = "duration";
+const char* progress_indicator = "progressIndicator";
+const char* alert_type = "alertType";
+const char* play_tone = "playTone";
+const char* soft_buttons = "softButtons";
+const char* soft_button_id = "softButtonID";
+const char* custom_presets = "customPresets";
+const char* audio_pass_display_text1 = "audioPassThruDisplayText1";
+const char* audio_pass_display_text2 = "audioPassThruDisplayText2";
+const char* max_duration = "maxDuration";
+const char* sampling_rate = "samplingRate";
+const char* bits_per_sample = "bitsPerSample";
+const char* audio_type = "audioType";
+const char* mute_audio = "muteAudio";
+const char* button_name = "buttonName";
+const char* button_event_mode = "buttonEventMode";
+const char* button_press_mode = "buttonPressMode";
+const char* custom_button_id = "customButtonID";
+const char* data_type = "dataType";
+const char* turn_list = "turnList";
+const char* turn_icon = "turnIcon";
+const char* next_turn_icon = "nextTurnIcon";
+const char* value = "value";
+const char* hmi_display_language = "hmiDisplayLanguage";
+const char* language = "language";
+const char* data = "data";
+const char* start_time = "startTime";
+const char* end_time = "endTime";
+const char* hours = "hours";
+const char* minutes = "minutes";
+const char* seconds = "seconds";
+const char* update_mode = "updateMode";
+const char* trigger_source = "triggerSource";
+const char* hmi_level = "hmiLevel";
+const char* activate_app_hmi_level = "level";
+const char* audio_streaming_state = "audioStreamingState";
+const char* system_context = "systemContext";
+const char* speech_capabilities = "speechCapabilities";
+const char* vr_capabilities = "vrCapabilities";
+const char* audio_pass_thru_capabilities = "audioPassThruCapabilities";
+const char* pcm_stream_capabilities = "pcmStreamCapabilities";
+// PutFile
+const char* sync_file_name = "syncFileName";
+const char* file_name = "fileName";
+const char* file_type = "fileType";
+const char* file_size = "fileSize";
+const char* request_type = "requestType";
+const char* persistent_file = "persistentFile";
+const char* file_data = "fileData";
+const char* space_available = "spaceAvailable";
+const char* image_type = "imageType";
+const char* image = "image";
+const char* type = "type";
+const char* system_file = "systemFile";
+const char* offset = "offset";
+const char* length = "length";
+const char* secondary_image = "secondaryImage";
+const char* filenames = "filenames";
+
+const char* hmi_display_language_desired = "hmiDisplayLanguageDesired";
+const char* ecu_name = "ecuName";
+const char* dtc_mask = "dtcMask";
+const char* did_location = "didLocation";
+const char* app_list = "appList";
+const char* device_list = "deviceList";
+const char* device_info = "deviceInfo";
+const char* name = "name";
+const char* id = "id";
+const char* isSDLAllowed = "isSDLAllowed";
+const char* transport_type = "transportType";
+const char* application = "application";
+const char* applications = "applications";
+const char* icon = "icon";
+const char* device_name = "deviceName";
+const char* reason = "reason";
+const char* available = "available";
+const char* text = "text";
+const char* character_set = "characterSet";
+const char* secondary_text = "secondaryText";
+const char* tertiary_text = "tertiaryText";
+const char* hardware = "hardware";
+const char* firmware_rev = "firmwareRev";
+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";
+const char* auto_complete_text = "autoCompleteText";
+const char* navigation_text = "navigationText";
+
+// vehicle info
+const char* gps = "gps";
+const char* speed = "speed";
+const char* rpm = "rpm";
+const char* fuel_level = "fuelLevel";
+const char* fuel_level_state = "fuelLevel_State";
+const char* instant_fuel_consumption = "instantFuelConsumption";
+const char* external_temp = "externalTemperature";
+const char* vin = "vin";
+const char* prndl = "prndl";
+const char* tire_pressure = "tirePressure";
+const char* odometer = "odometer";
+const char* belt_status = "beltStatus";
+const char* body_information = "bodyInformation";
+const char* device_status = "deviceStatus";
+const char* driver_braking = "driverBraking";
+const char* wiper_status = "wiperStatus";
+const char* head_lamp_status = "headLampStatus";
+const char* engine_torque = "engineTorque";
+const char* acc_pedal_pos = "accPedalPosition";
+const char* steering_wheel_angle = "steeringWheelAngle";
+const char* e_call_info = "eCallInfo";
+const char* airbag_status = "airbagStatus";
+const char* emergency_event = "emergencyEvent";
+const char* cluster_mode_status = "clusterModeStatus";
+const char* my_key = "myKey";
+const char* help_prompt = "helpPrompt";
+const char* scroll_message_body = "scrollableMessageBody";
+const char* data_result = "dataResult";
+const char* dtc_list = "dtcList";
+const char* interaction_mode = "interactionMode";
+const char* slider_position = "sliderPosition";
+const char* system_action = "systemAction";
+const char* prerecorded_speech = "prerecordedSpeech";
+const char* supported_diag_modes = "supportedDiagModes";
+const char* hmi_capabilities = "hmiCapabilities";
+const char* navigation = "navigation";
+const char* phone_call = "phoneCall";
+const char* sdl_version = "sdlVersion";
+const char* system_software_version = "systemSoftwareVersion";
+const char* priority = "priority";
+
+// resuming
+const char* application_commands = "applicationCommands";
+const char* application_submenus = "applicationSubMenus";
+const char* application_choice_sets = "applicationChoiceSets";
+const char* application_global_properties = "globalProperties";
+const char* application_vehicle_info = "vehicleInfo";
+const char* application_buttons = "buttons";
+const char* application_subscribtions = "subscribtions";
+const char* application_files = "applicationFiles";
+const char* application_show = "applicationShow";
+const char* resumption = "resumption";
+const char* resume_app_list = "resume_app_list";
+const char* last_ign_off_time = "last_ign_off_time";
+
+const char* resume_vr_grammars = "resumeVrGrammars";
+
+const char* ign_off_count = "ign_off_count";
+const char* suspend_count = "suspend_count";
+
+const char* connection_info = "connection_info";
+const char* is_download_complete = "is_download_complete";
+
+const char* hash_id = "hashID";
+const char* time_stamp = "timeStamp";
+const char* manual_text_entry = "manualTextEntry";
+const char* image_type_supported = "imageTypeSupported";
+const char* unexpected_disconnect = "unexpectedDisconnect";
+const char* longitude_degrees = "longitudeDegrees";
+const char* latitude_degrees = "latitudeDegrees";
+const char* address = "address";
+const char* country_name = "countryName";
+const char* country_code = "countryCode";
+const char* postal_code = "postalCode";
+const char* administrative_area = "administrativeArea";
+const char* locality = "locality";
+const char* sub_locality = "subLocality";
+const char* thoroughfare = "thoroughfare";
+const char* sub_thoroughfare = "subThoroughfare";
+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";
+
+const char* delivery_mode = "deliveryMode";
+} // namespace strings
+
+namespace json {
+const char* appId = "appId";
+const char* name = "name";
+const char* ios = "ios";
+const char* android = "android";
+const char* appHmiType = "appHmiType";
+const char* urlScheme = "urlScheme";
+const char* packageName = "packageName";
+const char* response = "response";
+const char* is_media_application = "isMediaApplication";
+const char* default_ = "default";
+const char* languages = "languages";
+const char* ttsName = "ttsName";
+const char* vrSynonyms = "vrSynonyms";
+} // namespace json
+
+namespace http_request {
+const char* httpRequest = "HTTPRequest";
+const char* headers = "headers";
+const char* content_type = "ContentType";
+const char* connect_timeout = "ConnectTimout";
+const char* do_output = "DoOutput";
+const char* do_input = "DoInput";
+const char* use_caches = "UseCaches";
+const char* request_method = "RequestMethod";
+const char* read_timeout = "ReadTimeout";
+const char* instance_follow_redirect = "InstanceFollowRedirect";
+const char* charset = "charset";
+const char* content_lenght = "Content_Lenght";
+const char* GET = "GET";
+} // http_request
+
+namespace mobile_notification {
+const char* state = "state";
+const char* syncp_timeout = "Timeout";
+const char* syncp_url = "URL";
+} // namespace mobile_notification
+
+namespace hmi_levels {
+const char* kFull = "FULL";
+const char* kLimited = "LIMITED";
+const char* kBackground = "BACKGROUND";
+const char* kNone = "NONE";
+}
+
+namespace hmi_request {
+const char* parent_id = "parentID";
+const char* field_name = "fieldName";
+const char* field_text = "fieldText";
+const char* alert_strings = "alertStrings";
+const char* duration = "duration";
+const char* soft_buttons = "softButtons";
+const char* tts_chunks = "ttsChunks";
+const char* speak_type = "speakType";
+const char* audio_pass_display_texts = "audioPassThruDisplayTexts";
+const char* max_duration = "maxDuration";
+const char* reason = "reason";
+const char* message_text = "messageText";
+const char* initial_text = "initialText";
+const char* navi_texts = "navigationTexts";
+const char* navi_text = "navigationText";
+const char* show_strings = "showStrings";
+const char* interaction_layout = "interactionLayout";
+const char* menu_title = "menuTitle";
+const char* menu_icon = "menuIcon";
+const char* keyboard_properties = "keyboardProperties";
+const char* method_name = "methodName";
+const char* keyboard_layout = "keyboardLayout";
+const char* limited_character_list = "limitedCharacterList";
+const char* auto_complete_text = "autoCompleteText";
+const char* file = "file";
+const char* retry = "retry";
+const char* service = "service";
+} // namespace hmi_request
+
+namespace hmi_response {
+const char* code = "code";
+const char* message = "message";
+const char* method = "method";
+const char* try_again_time = "tryAgainTime";
+const char* custom_button_id = "customButtonID";
+const char* button_name = "name";
+const char* button_mode = "mode";
+const char* attenuated_supported = "attenuatedSupported";
+const char* languages = "languages";
+const char* language = "language";
+const char* display_capabilities = "displayCapabilities";
+const char* hmi_zone_capabilities = "hmiZoneCapabilities";
+const char* soft_button_capabilities = "softButtonCapabilities";
+const char* image_supported = "imageSupported";
+const char* button_capabilities = "buttonCapabilities";
+const char* capabilities = "capabilities";
+const char* speech_capabilities = "speechCapabilities";
+const char* prerecorded_speech_capabilities = "prerecordedSpeechCapabilities";
+const char* preset_bank_capabilities = "presetBankCapabilities";
+const char* allowed = "allowed";
+const char* vehicle_type = "vehicleType";
+const char* did_result = "didResult";
+const char* result_code = "resultCode";
+const char* dtc = "dtc";
+const char* ecu_header = "ecuHeader";
+const char* image_capabilities = "imageCapabilities";
+const char* display_type = "displayType";
+const char* text_fields = "textFields";
+const char* media_clock_formats = "mediaClockFormats";
+const char* graphic_supported = "graphicSupported";
+const char* image_fields = "imageFields";
+const char* templates_available = "templatesAvailable";
+const char* screen_params = "screenParams";
+const char* num_custom_presets_available = "numCustomPresetsAvailable";
+const char* urls = "urls";
+const char* policy_app_id = "policyAppID";
+const char* enabled = "enabled";
+
+} // namespace hmi_response
+
+namespace hmi_notification {
+const char* prndl = "prndl";
+const char* file_name = "file_name";
+const char* system_context = "systemContext";
+const char* state = "state";
+const char* result = "result";
+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
+
+} // namespace application_manager
+
+#
diff --git a/src/components/application_manager/src/state_context.cc b/src/components/application_manager/src/state_context.cc
deleted file mode 100644
index ae3b40e094..0000000000
--- a/src/components/application_manager/src/state_context.cc
+++ /dev/null
@@ -1,62 +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/state_context.h"
-#include "application_manager/application_manager_impl.h"
-#include "config_profile/profile.h"
-
-namespace application_manager {
-
-
-bool StateContext::is_navi_app(const uint32_t app_id) const {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
- DCHECK_OR_RETURN(app, false);
- return app ? app->is_navi() : false;
-}
-
-bool StateContext::is_meida_app(const uint32_t app_id) const {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
- return app ? app->is_media_application() : false;
-}
-
-bool StateContext::is_voice_comunication_app(const uint32_t app_id) const {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
- return app ? app->is_voice_communication_supported() : false;
-}
-
-bool StateContext::is_attenuated_supported() const{
- const HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
- return hmi_capabilities.attenuated_supported() &&
- profile::Profile::instance()->is_mixing_audio_supported();
-}
-
-}
diff --git a/src/components/application_manager/src/state_controller.cc b/src/components/application_manager/src/state_controller.cc
deleted file mode 100644
index 05aaa2d2eb..0000000000
--- a/src/components/application_manager/src/state_controller.cc
+++ /dev/null
@@ -1,469 +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/state_controller.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/message_helper.h"
-#include "utils/helpers.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()) {
- return true;
- }
- return false;
-}
-
-StateController::StateController() : EventObserver() {
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent);
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnPhoneCall);
- 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);
-}
-
-void StateController::SetRegularState(
- ApplicationSharedPtr app,
- const mobile_apis::AudioStreamingState::eType audio_state) {
- if (!app) {
- return;
- }
- 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) {
- 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);
- }
- }
- }
-}
-
-void StateController::SetupRegularHmiState(ApplicationSharedPtr app,
- HmiStatePtr state) {
- using namespace mobile_apis;
- 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());
- HmiStatePtr curr_state = app->CurrentHmiState();
- 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);
- }
- }
- 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;
- 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);
- DCHECK_OR_RETURN_VOID(new_state);
- new_state->set_hmi_level(hmi_level);
- new_state->set_audio_streaming_state(audio_state);
- new_state->set_system_context(prev_state->system_context());
- SetupRegularHmiState(app, new_state);
-}
-
-void StateController::ApplyRegularState(ApplicationSharedPtr app,
- HmiStatePtr state) {
- 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));
-}
-
-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();
-}
-
-void StateController::on_event(const event_engine::Event &event) {
- using namespace smart_objects;
- using namespace event_engine;
- using namespace hmi_apis;
-
- LOG4CXX_AUTO_TRACE(logger_);
- const SmartObject &message = event.smart_object();
- 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();
- }
- break;
- }
- case FunctionID::BasicCommunication_OnPhoneCall: {
- bool is_active =
- message[strings::msg_params][hmi_notification::is_active].asBool();
- if (is_active) {
- OnPhoneCallStarted();
- } else {
- OnPhoneCallEnded();
- }
- break;
- }
- case FunctionID::VR_Started: {
- OnVRStarted();
- break;
- }
- case FunctionID::VR_Stopped: {
- OnVREnded();
- break;
- }
- case FunctionID::TTS_Started: {
- OnTTSStarted();
- break;
- }
- case FunctionID::TTS_Stopped: {
- OnTTSStopped();
- break;
- }
- default:
- break;
- }
-}
-
-void StateController::OnStateChanged(ApplicationSharedPtr app,
- HmiStatePtr old_state,
- HmiStatePtr new_state) {
- DCHECK_OR_RETURN_VOID(app);
- DCHECK_OR_RETURN_VOID(old_state);
- DCHECK_OR_RETURN_VOID(new_state);
- if (IsStatusChanged(old_state, new_state)) {
- MessageHelper::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());
- } else {
- LOG4CXX_ERROR(logger_, "Status not changed");
- }
-}
-
-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) {
- 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);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
- 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);
-}
-
-void StateController::TempStateStarted(HmiState::StateID ID) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(active_states_lock_);
- StateIDList::iterator it =
- std::find(active_states_.begin(), active_states_.end(), ID);
- if (it == active_states_.end()) {
- active_states_.push_back(ID);
- } else {
- 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);
-}
-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) {
- 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() {
- 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);
-}
-
-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);
-}
-
-void StateController::OnSafetyModeDisabled() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_SAFETY_MODE>),
- this));
- TempStateStopped(HmiState::STATE_ID_SAFETY_MODE);
-}
-
-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);
-}
-
-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);
-}
-
-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);
-}
-
-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::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);
-}
-
-void StateController::OnNaviStreamingStopped() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_NAVI_STREAMING>),
- this));
- TempStateStopped(HmiState::STATE_ID_NAVI_STREAMING);
-}
-
-HmiStatePtr StateController::CreateHmiState(uint32_t app_id,
- HmiState::StateID state_id) {
- 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_));
- break;
- }
- case HmiState::STATE_ID_SAFETY_MODE: {
- new_state.reset(new SafetyModeHmiState(app_id, state_context_));
- break;
- }
- case HmiState::STATE_ID_VR_SESSION: {
- new_state.reset(new VRHmiState(app_id, state_context_));
- break;
- }
- case HmiState::STATE_ID_TTS_SESSION: {
- new_state.reset(new TTSHmiState(app_id, state_context_));
- break;
- }
- case HmiState::STATE_ID_NAVI_STREAMING: {
- new_state.reset(new NaviStreamingHmiState(app_id, state_context_));
- break;
- }
- case HmiState::STATE_ID_REGULAR: {
- new_state.reset(new HmiState(app_id, state_context_));
- break;
- }
- default:
- LOG4CXX_FATAL(logger_, "Invalid state_id " << state_id);
- NOTREACHED();
- break;
- }
- 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;
-}
-}
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
new file mode 100644
index 0000000000..839cc13026
--- /dev/null
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -0,0 +1,966 @@
+/*
+ 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/state_controller_impl.h"
+#include "application_manager/usage_statistics.h"
+#include "utils/helpers.h"
+#include "utils/make_shared.h"
+#include "connection_handler/connection_handler.h"
+
+namespace application_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "StateControllerImpl")
+
+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;
+}
+
+StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr)
+ : EventObserver(app_mngr.event_dispatcher()), 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 StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ HmiStatePtr state,
+ const bool send_activate_app) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ 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 (app->is_resuming() && !IsResumptionAllowed(app, state)) {
+ return;
+ }
+
+ 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);
+
+ if (send_activate_app && is_full_allowed) {
+ const 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;
+ }
+ LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
+ return;
+ }
+ ApplyRegularState(app, resolved_state);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const bool send_activate_app) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ 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(app, hmi_state, send_activate_app);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const bool send_activate_app) {
+ using namespace mobile_apis;
+ using namespace helpers;
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ return;
+ }
+ 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(app, hmi_state, send_activate_app);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::SystemContext::eType system_context,
+ const bool send_activate_app) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ 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(app, hmi_state, send_activate_app);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ return;
+ }
+ 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);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::SystemContext::eType system_context) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ 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(
+ CalcAudioState(app, prev_regular->hmi_level()));
+ hmi_state->set_system_context(system_context);
+ SetRegularState(app, hmi_state, false);
+}
+
+void StateControllerImpl::SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::AudioStreamingState::eType audio_state) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ return;
+ }
+ 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(app, hmi_state, false);
+}
+
+void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ HmiStatePtr state) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application pointer");
+ return;
+ }
+ DCHECK_OR_RETURN_VOID(state);
+ if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
+ SetRegularState(app, state, true);
+ } else {
+ SetRegularState(app, state, false);
+ }
+}
+
+void StateControllerImpl::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 StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
+ HmiStatePtr state) const {
+ using namespace mobile_apis;
+ using namespace helpers;
+ 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 StateControllerImpl::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 StateControllerImpl::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 StateControllerImpl::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 StateControllerImpl::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 StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
+ HmiStatePtr state) {
+ 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());
+ HmiStatePtr curr_state = app->CurrentHmiState();
+ 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 (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_mngr_);
+ }
+ app->set_is_resuming(false);
+
+ HmiStatePtr new_state = app->CurrentHmiState();
+ OnStateChanged(app, old_state, new_state);
+}
+
+void StateControllerImpl::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);
+ DCHECK_OR_RETURN_VOID(new_state);
+ new_state->set_hmi_level(hmi_level);
+ new_state->set_audio_streaming_state(audio_state);
+ new_state->set_system_context(prev_state->system_context());
+ SetupRegularHmiState(app, new_state);
+}
+
+void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
+ 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>(
+ HmiLevelConflictResolver(app, state, this));
+}
+
+bool StateControllerImpl::IsSameAppType(ApplicationConstSharedPtr app1,
+ 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 StateControllerImpl::on_event(const event_engine::Event& event) {
+ 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());
+ switch (id) {
+ case FunctionID::BasicCommunication_ActivateApp: {
+ OnActivateAppResponse(message);
+ break;
+ }
+ case FunctionID::BasicCommunication_OnAppActivated: {
+ OnAppActivated(message);
+ break;
+ }
+ case FunctionID::BasicCommunication_OnAppDeactivated: {
+ OnAppDeactivated(message);
+ break;
+ }
+ case FunctionID::VR_Started: {
+ ApplyTempState<HmiState::STATE_ID_VR_SESSION>();
+ break;
+ }
+ case FunctionID::VR_Stopped: {
+ CancelTempState<HmiState::STATE_ID_VR_SESSION>();
+ break;
+ }
+ case FunctionID::TTS_Started: {
+ ApplyTempState<HmiState::STATE_ID_TTS_SESSION>();
+ break;
+ }
+ case FunctionID::TTS_Stopped: {
+ 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:
+ break;
+ }
+}
+
+void StateControllerImpl::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)) {
+ app_mngr_.SendHMIStatusNotification(app);
+ if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ app->ResetDataInNone();
+ }
+ 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");
+ }
+}
+
+bool StateControllerImpl::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 StateControllerImpl::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) {
+ 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);
+ HmiStatePtr old_hmi_state = app->CurrentHmiState();
+ 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 StateControllerImpl::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,
+ app_mngr_.connection_handler().get_session_observer(),
+ app_mngr_.GetPolicyHandler(),
+ level,
+ send_policy_priority,
+ app_mngr_);
+ if (!bc_activate_app_request) {
+ LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest");
+ return -1;
+ }
+ if (!app_mngr_.ManageHMICommand(bc_activate_app_request)) {
+ 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 StateControllerImpl::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 StateControllerImpl::TempStateStarted(HmiState::StateID ID) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(active_states_lock_);
+ StateIDList::iterator it =
+ std::find(active_states_.begin(), active_states_.end(), ID);
+ if (it == active_states_.end()) {
+ active_states_.push_back(ID);
+ } else {
+ LOG4CXX_ERROR(logger_, "StateID " << ID << " is already active");
+ }
+}
+
+void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ {
+ sync_primitives::AutoLock autolock(active_states_lock_);
+ active_states_.remove(ID);
+ }
+ ForEachApplication(std::bind1st(
+ std::mem_fun(&StateControllerImpl::ApplyPostponedStateForApp), this));
+}
+
+void StateControllerImpl::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(app, new_regular, false);
+}
+
+void StateControllerImpl::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 = 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);
+ ApplyRegularState(application, pending_state);
+ }
+}
+
+void StateControllerImpl::OnAppActivated(
+ const smart_objects::SmartObject& message) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ 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;
+ }
+
+ SetRegularState(app, HMILevel::HMI_FULL, true);
+}
+
+void StateControllerImpl::OnAppDeactivated(
+ const smart_objects::SmartObject& message) {
+ using namespace hmi_apis;
+ using namespace mobile_apis;
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ 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;
+ }
+
+ if (HMILevel::HMI_FULL != app->hmi_level()) {
+ return;
+ }
+
+ // TODO(AOleynik): Need to delete DeactivateReason and modify OnAppDeactivated
+ // when HMI will support that, otherwise won't be testable
+ DeactivateApp(app);
+}
+
+void StateControllerImpl::OnNaviStreamingStarted() {
+ ApplyTempState<HmiState::STATE_ID_NAVI_STREAMING>();
+}
+
+void StateControllerImpl::OnNaviStreamingStopped() {
+ CancelTempState<HmiState::STATE_ID_NAVI_STREAMING>();
+}
+
+bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ switch (state_id) {
+ case HmiState::STATE_ID_CURRENT:
+ case HmiState::STATE_ID_REGULAR:
+ return true;
+ default:
+ return IsTempStateActive(state_id);
+ }
+ return false;
+}
+
+HmiStatePtr StateControllerImpl::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 = MakeShared<PhoneCallHmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_SAFETY_MODE: {
+ new_state = MakeShared<SafetyModeHmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_VR_SESSION: {
+ new_state = MakeShared<VRHmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_TTS_SESSION: {
+ new_state = MakeShared<TTSHmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_NAVI_STREAMING: {
+ new_state = MakeShared<NaviStreamingHmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_REGULAR: {
+ 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:
+ LOG4CXX_FATAL(logger_, "Invalid state_id " << state_id);
+ NOTREACHED();
+ break;
+ }
+ return new_state;
+}
+
+mobile_apis::AudioStreamingState::eType StateControllerImpl::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..42c48520e9 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 "policy/usage_statistics/statistics_manager.h"
#include "utils/macro.h"
+#include "utils/make_shared.h"
using namespace mobile_apis;
using namespace NsSmartDeviceLink::NsSmartObjects;
@@ -47,27 +47,52 @@ namespace {
std::string LanguageIdToString(Language::eType lang_id) {
const char* str;
- const bool ok = EnumConversionHelper<Language::eType>::EnumToCString(lang_id, &str);
+ const bool ok =
+ EnumConversionHelper<Language::eType>::EnumToCString(lang_id, &str);
return ok ? str : "unknown";
}
} // namespace
-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);
+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<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 +114,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 +147,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..118cda4fcb 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,66 +31,61 @@
# TODO{ALeshin}: APPLINK-10792. Do not write tests which use
# application manager(AM) singleton while refactoring of AM is finished.
-# 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)
-list(FIND the_include_dirs ${class_to_mock} find_idx)
-if(find_idx GREATER -1)
- LIST_REPLACE(the_include_dirs ${find_idx} ${AM_MOCK_DIR}/include)
-endif()
-set_property(DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES ${the_include_dirs})
-
-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}/application_manager/include/application_manager/
- ${COMPONENTS_DIR}/application_manager/include/application_manager/policies
-)
-
-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
-)
-
-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/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
-)
+if (BUILD_TESTS)
+
include_directories(
- ${AM_SOURCE_DIR}/policy/src/policy/policy_table/table_struct
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${CMAKE_BINARY_DIR}/src/components/
+ ${COMPONENTS_DIR}/application_manager/include/
+ ${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/resumption/include/
+ ${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/policy/include/
+ ${COMPONENTS_DIR}/media_manager/include/
+ ${COMPONENTS_DIR}/security_manager/include/
+ ${COMPONENTS_DIR}/policy/test/include/
+ ${COMPONENTS_DIR}/application_manager/test/include/
+ )
+
+ set(testSources
+ ${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}/policy_event_observer_test.cc
+ ${AM_TEST_DIR}/application_impl_test.cc
+ ${AM_TEST_DIR}/hmi_capabilities_test.cc
+ ${AM_TEST_DIR}/application_state_test.cc
+ ${AM_TEST_DIR}/usage_statistics_test.cc
+ ${AM_TEST_DIR}/policy_handler_test.cc
+ ${AM_TEST_DIR}/mock_message_helper.cc
+ )
+ set (request_controller_SOURCES
+ ${AM_TEST_DIR}/request_controller/request_controller_test.cc
)
+
set(testLibraries
- gmock
+ ApplicationManager
+ 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
@@ -113,32 +108,65 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
list(REMOVE_ITEM test_exec_libraries dl)
endif()
-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 expat -L${EXPAT_LIBS_DIRECTORY})
-endif()
+ set(testLibraries
+ Utils
+ ApplicationManager
+ 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
+ )
-add_library("ApplicationManagerTest" ${mockedSources} ${testSources})
+ if (${CMAKE_SYSTEM_NAME} MATCHES "QNX")
+ list(REMOVE_ITEM test_exec_libraries dl)
+ endif()
-target_link_libraries("ApplicationManagerTest" ${testLibraries} AMHMICommandsLibrary
- AMMobileCommandsLibrary
- AMEventEngine
- AMPolicyLibrary)
+ 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 expat -L${EXPAT_LIBS_DIRECTORY})
+ endif()
-create_test("application_manager_test" "${testSources}" "${ApplicationManagerTest}")
-target_link_libraries("application_manager_test"
- ApplicationManagerTest ${test_exec_libraries}
- ApplicationManager
- ProtocolLibrary
- connectionHandler
- ConfigProfile
- jsoncpp
- MediaManager
- ProtocolHandler
- Resumption
-)
+ file(COPY smartDeviceLink_test2.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-#add_executable(application_manager_test ${testSources})
-#target_link_libraries(application_manager_test ApplicationManagerTest ${test_exec_libraries})
+add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so
+ COMMAND ${CMAKE_COMMAND} -E
+ copy ${COMPONENTS_DIR}/policy/libPolicy.so ${CMAKE_CURRENT_BINARY_DIR})
+ set(CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}")
+ create_test("application_manager_test" "${testSources}" "${testLibraries}" )
+# 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
+ ${AM_TEST_DIR}/resumption/resumption_data_json_test.cc
+ ${AM_TEST_DIR}/resumption/resume_ctrl_test.cc
+ ${AM_TEST_DIR}/mock_message_helper.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/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
new file mode 100644
index 0000000000..7989f11fce
--- /dev/null
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -0,0 +1,732 @@
+/*
+ * 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/application_impl.h"
+#include <iostream>
+#include "gtest/gtest.h"
+#include "application_manager/hmi_state.h"
+#include "utils/file_system.h"
+
+#include "utils/make_shared.h"
+#include "application_manager/mock_message_helper.h"
+#include "utils/custom_string.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/state_controller.h"
+#include "resumption/last_state.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "policy/mock_statistics_manager.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using namespace application_manager;
+
+using namespace mobile_apis;
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+namespace custom_str = utils::custom_string;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::AtLeast;
+using usage_statistics_test::MockStatisticsManager;
+
+typedef void (ApplicationImpl::*AddSet)(HmiStatePtr args);
+
+class ApplicationImplTest : public ::testing::Test {
+ protected:
+ virtual void SetUp() OVERRIDE {
+ app_id = 10;
+ policy_app_id = "policy_app_id";
+ app_name = "app_name";
+ mac_address = "mac_address";
+ test_lvl = HMILevel::INVALID_ENUM;
+ state_id = HmiState::STATE_ID_REGULAR;
+ audiostate = AudioStreamingState::NOT_AUDIBLE;
+ syst_context = SystemContext::SYSCTXT_MAIN;
+
+ testHmiState = CreateTestHmiState();
+ EXPECT_CALL(mock_application_manager_, CreateRegularState(app_id, _, _, _))
+ .WillOnce(Return(testHmiState));
+ EXPECT_CALL(mock_application_manager_, get_settings())
+ .WillRepeatedly(ReturnRef(mock_application_manager_settings_));
+ EXPECT_CALL(mock_application_manager_settings_, app_icons_folder())
+ .WillRepeatedly(ReturnRef(directory_name));
+ EXPECT_CALL(mock_application_manager_settings_, app_storage_folder())
+ .WillRepeatedly(ReturnRef(directory_name));
+ EXPECT_CALL(mock_application_manager_settings_,
+ audio_data_stopped_timeout()).WillOnce(Return(0));
+ EXPECT_CALL(mock_application_manager_settings_,
+ video_data_stopped_timeout()).WillOnce(Return(0));
+ app_impl = new ApplicationImpl(app_id,
+ policy_app_id,
+ mac_address,
+ app_name,
+ utils::MakeShared<MockStatisticsManager>(),
+ mock_application_manager_);
+ }
+ void TearDown() OVERRIDE {
+ delete app_impl;
+ }
+ HmiStatePtr CreateTestHmiState();
+
+ HmiStatePtr TestAddHmiState(HMILevel::eType hmi_lvl,
+ HmiState::StateID id_state,
+ AddSet hmi_action);
+
+ void CheckCurrentHMIState();
+ MockApplicationManagerSettings mock_application_manager_settings_;
+ MockApplicationManager mock_application_manager_;
+ ApplicationImpl* app_impl;
+ uint32_t app_id;
+ std::string policy_app_id;
+ std::string mac_address;
+ custom_str::CustomString app_name;
+ const std::string directory_name = "./test_storage";
+ HmiState::StateID state_id;
+ HmiStatePtr testHmiState;
+ HMILevel::eType test_lvl;
+ AudioStreamingState::eType audiostate;
+ SystemContext::eType syst_context;
+};
+
+HmiStatePtr ApplicationImplTest::CreateTestHmiState() {
+ HmiStatePtr testState =
+ utils::MakeShared<HmiState>(app_id, mock_application_manager_, state_id);
+ testState->set_hmi_level(test_lvl);
+ testState->set_audio_streaming_state(audiostate);
+ testState->set_system_context(syst_context);
+ return testState;
+}
+
+HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl,
+ HmiState::StateID id_state,
+ AddSet hmi_action) {
+ test_lvl = hmi_lvl;
+ state_id = id_state;
+ HmiStatePtr state = CreateTestHmiState();
+ (app_impl->*hmi_action)(state);
+ return state;
+}
+
+void ApplicationImplTest::CheckCurrentHMIState() {
+ HmiStatePtr current_state = app_impl->CurrentHmiState();
+ EXPECT_EQ(test_lvl, current_state->hmi_level());
+ EXPECT_EQ(state_id, current_state->state_id());
+}
+
+TEST_F(ApplicationImplTest, AddHmiState_GetCurrentState) {
+ TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_PHONE_CALL,
+ &ApplicationImpl::AddHMIState);
+
+ CheckCurrentHMIState();
+ EXPECT_EQ(app_id, app_impl->app_id());
+}
+
+TEST_F(ApplicationImplTest, AddRegularHmiState_GetCurrentState) {
+ TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_REGULAR,
+ &ApplicationImpl::SetRegularState);
+
+ CheckCurrentHMIState();
+ EXPECT_EQ(app_id, app_impl->app_id());
+}
+
+TEST_F(ApplicationImplTest, AddStateAddRegularState_GetCurrentState) {
+ TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_REGULAR,
+ &ApplicationImpl::SetRegularState);
+ TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+
+ CheckCurrentHMIState();
+ EXPECT_EQ(app_id, app_impl->app_id());
+}
+
+TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) {
+ TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_REGULAR,
+ &ApplicationImpl::SetRegularState);
+ TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+
+ HmiStatePtr current_state = app_impl->RegularHmiState();
+ EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
+ EXPECT_EQ(HmiState::STATE_ID_REGULAR, current_state->state_id());
+ EXPECT_EQ(app_id, app_impl->app_id());
+}
+
+TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
+ // First state
+ TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_PHONE_CALL,
+ &ApplicationImpl::AddHMIState);
+ HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+ HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_TTS_SESSION,
+ &ApplicationImpl::AddHMIState);
+
+ CheckCurrentHMIState();
+
+ // Remove last state
+ app_impl->RemoveHMIState(state3->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState();
+ EXPECT_EQ(state2, current_state);
+ EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level());
+ EXPECT_EQ(HmiState::STATE_ID_NAVI_STREAMING, current_state->state_id());
+}
+
+TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
+ HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_PHONE_CALL,
+ &ApplicationImpl::AddHMIState);
+ HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+ HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_TTS_SESSION,
+ &ApplicationImpl::AddHMIState);
+
+ CheckCurrentHMIState();
+
+ // Remove not last state
+ app_impl->RemoveHMIState(state2->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState();
+ EXPECT_EQ(state3, current_state);
+ // HMI level is equal to parent hmi_level
+ EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
+ EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
+ EXPECT_EQ(state1, current_state->parent());
+}
+
+TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
+ HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_PHONE_CALL,
+ &ApplicationImpl::AddHMIState);
+ // Second state
+ TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+ HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_TTS_SESSION,
+ &ApplicationImpl::AddHMIState);
+ CheckCurrentHMIState();
+
+ // Remove first added state
+ app_impl->RemoveHMIState(state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState();
+ EXPECT_EQ(state3, current_state);
+ // Last state does not have a parent
+ EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
+ EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
+ EXPECT_EQ(NULL, current_state->parent());
+}
+
+TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
+ HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+ // Set regular state
+ HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_REGULAR,
+ &ApplicationImpl::SetRegularState);
+ HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_TTS_SESSION,
+ &ApplicationImpl::AddHMIState);
+ CheckCurrentHMIState();
+
+ // Remove first state
+ app_impl->RemoveHMIState(state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState();
+ EXPECT_EQ(state3, current_state);
+ // Last state has a parent
+ EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
+ EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
+ EXPECT_EQ(state2, current_state->parent());
+}
+
+TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) {
+ // Set postponed hmi state
+ HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_POSTPONED,
+ &ApplicationImpl::SetPostponedState);
+
+ // Check that state was setted correctly
+ HmiStatePtr state2 = app_impl->PostponedHmiState();
+ EXPECT_EQ(state1, state2);
+
+ // Check that state was correctly removed
+ app_impl->RemovePostponedState();
+ state2 = app_impl->PostponedHmiState();
+ EXPECT_EQ(NULL, state2);
+}
+
+TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
+ audiostate = AudioStreamingState::ATTENUATED;
+ syst_context = SystemContext::SYSCTXT_ALERT;
+ TestAddHmiState(HMILevel::HMI_FULL,
+ HmiState::STATE_ID_REGULAR,
+ &ApplicationImpl::SetRegularState);
+
+ EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
+ EXPECT_EQ(syst_context, app_impl->system_context());
+
+ audiostate = AudioStreamingState::AUDIBLE;
+ syst_context = SystemContext::SYSCTXT_MENU;
+ TestAddHmiState(HMILevel::HMI_LIMITED,
+ HmiState::STATE_ID_NAVI_STREAMING,
+ &ApplicationImpl::AddHMIState);
+
+ EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
+ EXPECT_EQ(syst_context, app_impl->system_context());
+}
+
+TEST_F(ApplicationImplTest, IsAudioApplication) {
+ EXPECT_FALSE(app_impl->IsAudioApplication());
+ app_impl->set_is_navi(true);
+ app_impl->set_is_media_application(false);
+ app_impl->set_voice_communication_supported(false);
+ EXPECT_TRUE(app_impl->IsAudioApplication());
+ app_impl->set_is_navi(false);
+ app_impl->set_is_media_application(true);
+ app_impl->set_voice_communication_supported(false);
+ EXPECT_TRUE(app_impl->IsAudioApplication());
+ app_impl->set_is_navi(false);
+ app_impl->set_is_media_application(false);
+ app_impl->set_voice_communication_supported(true);
+ EXPECT_TRUE(app_impl->IsAudioApplication());
+ app_impl->set_is_media_application(false);
+ app_impl->set_voice_communication_supported(false);
+ app_impl->set_is_navi(false);
+ EXPECT_FALSE(app_impl->IsAudioApplication());
+}
+
+TEST_F(ApplicationImplTest, AddFile) {
+ AppFile test_file;
+
+ test_file.is_persistent = true;
+ test_file.is_download_complete = false;
+ test_file.file_type = FileType::AUDIO_AAC;
+ test_file.file_name = "test_file 1";
+
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+ test_file.is_download_complete = true;
+ EXPECT_FALSE(app_impl->AddFile(test_file));
+ test_file.file_name = "test_file 2";
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+}
+
+TEST_F(ApplicationImplTest, UpdateFile) {
+ AppFile test_file;
+
+ test_file.is_persistent = true;
+ test_file.is_download_complete = false;
+ test_file.file_type = FileType::AUDIO_AAC;
+ test_file.file_name = "test_file 1";
+
+ EXPECT_FALSE(app_impl->UpdateFile(test_file));
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+ test_file.is_download_complete = true;
+ EXPECT_FALSE(app_impl->AddFile(test_file));
+ EXPECT_TRUE(app_impl->UpdateFile(test_file));
+}
+
+TEST_F(ApplicationImplTest, DeleteFile) {
+ AppFile test_file;
+ test_file.is_persistent = true;
+ test_file.is_download_complete = false;
+ test_file.file_type = FileType::AUDIO_AAC;
+ test_file.file_name = "test_file 1";
+
+ EXPECT_FALSE(app_impl->DeleteFile(test_file.file_name));
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+ EXPECT_TRUE(app_impl->DeleteFile(test_file.file_name));
+ EXPECT_FALSE(app_impl->DeleteFile(test_file.file_name));
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+}
+
+TEST_F(ApplicationImplTest, GetFile) {
+ AppFile test_file;
+ test_file.is_persistent = true;
+ test_file.is_download_complete = true;
+ test_file.file_type = FileType::GRAPHIC_JPEG;
+ test_file.file_name = "test_file 1";
+
+ EXPECT_EQ(NULL, app_impl->GetFile(test_file.file_name));
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+ const AppFile* app_file = app_impl->GetFile(test_file.file_name);
+ EXPECT_EQ(test_file.is_persistent, app_file->is_persistent);
+ EXPECT_EQ(test_file.is_download_complete, app_file->is_download_complete);
+ EXPECT_EQ(test_file.file_type, app_file->file_type);
+}
+
+TEST_F(ApplicationImplTest, SetIconPath) {
+ AppFile test_file;
+ test_file.is_persistent = true;
+ test_file.is_download_complete = false;
+ test_file.file_type = FileType::GRAPHIC_BMP;
+ test_file.file_name = "test_file 1";
+
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+ test_file.file_name = "test_file 2";
+ test_file.file_type = FileType::GRAPHIC_PNG;
+ EXPECT_TRUE(app_impl->AddFile(test_file));
+
+ EXPECT_TRUE(app_impl->set_app_icon_path(test_file.file_name));
+ EXPECT_EQ(test_file.file_name, app_impl->app_icon_path());
+}
+
+TEST_F(ApplicationImplTest, LoadPersistentFiles) {
+ // Precondition
+ // Create test folder with diff files
+
+ app_impl->MarkRegistered();
+ std::string folder_name = "";
+ app_impl->set_folder_name(folder_name);
+
+ file_system::CreateDirectory(directory_name);
+
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file1.json"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file2.bmp"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file3.jpeg"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file4.png"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file5"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file6.wave"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file7.mp4"));
+ EXPECT_TRUE(file_system::CreateFile(directory_name + "/test_file8.mp3"));
+
+ app_impl->LoadPersistentFiles();
+
+ AppFilesMap files_map = app_impl->getAppFiles();
+
+ EXPECT_EQ(8u, files_map.size());
+ const AppFile* test_file1 =
+ app_impl->GetFile(directory_name + "//test_file1.json");
+ ASSERT_TRUE(test_file1);
+ EXPECT_EQ(FileType::JSON, test_file1->file_type);
+ const AppFile* test_file2 =
+ app_impl->GetFile(directory_name + "//test_file2.bmp");
+ ASSERT_TRUE(test_file2);
+ EXPECT_EQ(FileType::GRAPHIC_BMP, test_file2->file_type);
+ const AppFile* test_file3 =
+ app_impl->GetFile(directory_name + "//test_file3.jpeg");
+ ASSERT_TRUE(test_file3);
+ EXPECT_EQ(FileType::GRAPHIC_JPEG, test_file3->file_type);
+ const AppFile* test_file4 =
+ app_impl->GetFile(directory_name + "//test_file4.png");
+ ASSERT_TRUE(test_file4);
+ EXPECT_EQ(FileType::GRAPHIC_PNG, test_file4->file_type);
+ const AppFile* test_file5 =
+ app_impl->GetFile(directory_name + "//test_file5");
+ ASSERT_TRUE(test_file5);
+ EXPECT_EQ(FileType::BINARY, test_file5->file_type);
+ const AppFile* test_file6 =
+ app_impl->GetFile(directory_name + "//test_file6.wave");
+ ASSERT_TRUE(test_file6);
+ EXPECT_EQ(FileType::AUDIO_WAVE, test_file6->file_type);
+ const AppFile* test_file7 =
+ app_impl->GetFile(directory_name + "//test_file7.mp4");
+ ASSERT_TRUE(test_file7);
+ EXPECT_EQ(FileType::AUDIO_AAC, test_file7->file_type);
+ const AppFile* test_file8 =
+ app_impl->GetFile(directory_name + "//test_file8.mp3");
+ ASSERT_TRUE(test_file8);
+ EXPECT_EQ(FileType::AUDIO_MP3, test_file8->file_type);
+}
+
+TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_SetLimitFromConfig) {
+ std::pair<uint32_t, int32_t> get_frequency;
+ get_frequency.first = 5;
+ get_frequency.second = 1;
+ EXPECT_CALL(mock_application_manager_settings_, read_did_frequency())
+ .WillRepeatedly(ReturnRef(get_frequency));
+ EXPECT_CALL(mock_application_manager_settings_, get_vehicle_data_frequency())
+ .WillRepeatedly(ReturnRef(get_frequency));
+ for (uint32_t i = 0; i < get_frequency.first; i++) {
+ EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::CONFIG_FILE));
+ }
+ EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::CONFIG_FILE));
+
+ for (uint32_t i = 0; i < get_frequency.first; i++) {
+ EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::CONFIG_FILE));
+ }
+ EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::CONFIG_FILE));
+}
+
+TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_LimitFromPT) {
+ policy_test::MockPolicyHandlerInterface policy_interface;
+ EXPECT_CALL(mock_application_manager_, GetPolicyHandler())
+ .WillRepeatedly(ReturnRef(policy_interface));
+ EXPECT_CALL(policy_interface, GetPriority(policy_app_id, _))
+ .WillRepeatedly(Return(false));
+
+ EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
+ .WillOnce(Return(100u));
+ EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::POLICY_TABLE));
+
+ EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
+ .WillOnce(Return(100u));
+ EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::POLICY_TABLE));
+ EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
+ .WillRepeatedly(Return(0));
+ EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::POLICY_TABLE));
+ EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::POLICY_TABLE));
+}
+
+TEST_F(ApplicationImplTest, SubscribeToButton_UnsubscribeFromButton) {
+ EXPECT_TRUE(app_impl->SubscribeToButton(ButtonName::PRESET_0));
+ // It is impossible to subsribe to the same button twice
+ EXPECT_FALSE(app_impl->SubscribeToButton(ButtonName::PRESET_0));
+ EXPECT_TRUE(app_impl->IsSubscribedToButton(ButtonName::PRESET_0));
+ EXPECT_TRUE(app_impl->UnsubscribeFromButton(ButtonName::PRESET_0));
+ EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::PRESET_0));
+}
+
+TEST_F(ApplicationImplTest, SubscribeToDefaultButton_UnsubscribeFromButton) {
+ EXPECT_TRUE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON));
+ EXPECT_FALSE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON));
+}
+
+TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
+ const uint btn_count = 10;
+ for (uint i = 0; i < btn_count; i++) {
+ EXPECT_FALSE(app_impl->IsSubscribedToSoftButton(i));
+ }
+
+ SoftButtonID test_button;
+ for (uint i = 0; i < btn_count; i++) {
+ test_button.insert(i);
+ }
+ app_impl->SubscribeToSoftButtons(FunctionID::ScrollableMessageID,
+ test_button);
+
+ for (uint i = 0; i < btn_count; i++) {
+ EXPECT_TRUE(app_impl->IsSubscribedToSoftButton(i));
+ }
+ app_impl->UnsubscribeFromSoftButtons(FunctionID::ScrollableMessageID);
+
+ for (uint i = 0; i < btn_count; i++) {
+ EXPECT_FALSE(app_impl->IsSubscribedToSoftButton(i));
+ }
+}
+
+TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) {
+ smart_objects::SmartObject type_media;
+ type_media[0] = AppHMIType::MEDIA;
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+
+ app_impl->set_app_types(type_media);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+}
+
+TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) {
+ smart_objects::SmartObject type_comm;
+ type_comm[0] = AppHMIType::COMMUNICATION;
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+
+ app_impl->set_app_types(type_comm);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_TRUE(app_impl->is_voice_communication_supported());
+}
+
+TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) {
+ smart_objects::SmartObject type_navi;
+ type_navi[0] = AppHMIType::NAVIGATION;
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+
+ app_impl->set_app_types(type_navi);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_TRUE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+}
+
+TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) {
+ smart_objects::SmartObject app_types;
+ app_types[0] = AppHMIType::NAVIGATION;
+ app_types[1] = AppHMIType::COMMUNICATION;
+ app_types[2] = AppHMIType::MEDIA;
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_TRUE(app_impl->is_navi());
+ EXPECT_TRUE(app_impl->is_voice_communication_supported());
+}
+
+TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendHashUpdateNotification(app_id, _)).Times(1);
+ app_impl->UpdateHash();
+
+ EXPECT_TRUE(app_impl->is_application_data_changed());
+}
+
+TEST_F(ApplicationImplTest, StartStreaming_MobileNavi_StreamingNotApproved) {
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendNaviStartStream(app_id, _));
+ app_impl->StartStreaming(protocol_handler::ServiceType::kMobileNav);
+
+ EXPECT_EQ(0u, app_impl->video_stream_retry_number());
+}
+
+TEST_F(ApplicationImplTest, StartStreaming_Audio_StreamingNotApproved) {
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendAudioStartStream(app_id, _));
+ app_impl->StartStreaming(protocol_handler::ServiceType::kAudio);
+
+ EXPECT_EQ(0u, app_impl->video_stream_retry_number());
+}
+
+TEST_F(ApplicationImplTest, StartStreaming_StreamingApproved) {
+ app_impl->set_video_streaming_approved(true);
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendNaviStartStream(app_id, _)).Times(0);
+ app_impl->StartStreaming(protocol_handler::ServiceType::kMobileNav);
+
+ app_impl->set_audio_streaming_approved(true);
+
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendAudioStartStream(app_id, _)).Times(0);
+ app_impl->StartStreaming(protocol_handler::ServiceType::kAudio);
+}
+
+TEST_F(ApplicationImplTest, SuspendNaviStreaming) {
+ protocol_handler::ServiceType type =
+ protocol_handler::ServiceType::kMobileNav;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ app_impl->SuspendStreaming(type);
+}
+
+TEST_F(ApplicationImplTest, SuspendAudioStreaming) {
+ protocol_handler::ServiceType type = protocol_handler::ServiceType::kAudio;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ app_impl->SuspendStreaming(type);
+}
+
+// TODO {AKozoriz} : Fix tests with streaming (APPLINK-19289)
+TEST_F(ApplicationImplTest, DISABLED_Suspend_WakeUpAudioStreaming) {
+ protocol_handler::ServiceType type = protocol_handler::ServiceType::kAudio;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ app_impl->SuspendStreaming(type);
+
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, true));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, true, _));
+ app_impl->WakeUpStreaming(type);
+}
+
+TEST_F(ApplicationImplTest, DISABLED_Suspend_WakeUpNaviStreaming) {
+ protocol_handler::ServiceType type =
+ protocol_handler::ServiceType::kMobileNav;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ app_impl->SuspendStreaming(type);
+
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, true));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, true, _));
+ app_impl->WakeUpStreaming(type);
+}
+
+TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
+ // Stop navigation streaming
+ protocol_handler::ServiceType type =
+ protocol_handler::ServiceType::kMobileNav;
+ app_impl->set_video_streaming_approved(true);
+
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendNaviStopStream(app_id, _));
+
+ app_impl->StopStreaming(type);
+ EXPECT_FALSE(app_impl->video_streaming_approved());
+
+ // Stop audio streaming
+ app_impl->set_audio_streaming_approved(true);
+ type = protocol_handler::ServiceType::kAudio;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendAudioStopStream(app_id, _));
+
+ app_impl->StopStreaming(type);
+ EXPECT_FALSE(app_impl->audio_streaming_approved());
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc
new file mode 100644
index 0000000000..7bc34966b4
--- /dev/null
+++ b/src/components/application_manager/test/application_state_test.cc
@@ -0,0 +1,268 @@
+/*
+ * 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/application_state.h"
+#include "gtest/gtest.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "resumption/last_state.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+#include "utils/make_shared.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using namespace application_manager;
+using namespace mobile_apis;
+typedef HmiState::StateID StateID;
+
+namespace {
+std::vector<StateID> GenerateCurrentStates() {
+ std::vector<StateID> states;
+ states.push_back(StateID::STATE_ID_PHONE_CALL);
+ states.push_back(StateID::STATE_ID_SAFETY_MODE);
+ states.push_back(StateID::STATE_ID_VR_SESSION);
+ states.push_back(StateID::STATE_ID_TTS_SESSION);
+ states.push_back(StateID::STATE_ID_NAVI_STREAMING);
+ states.push_back(StateID::STATE_ID_DEACTIVATE_HMI);
+ return states;
+}
+}
+
+class ApplicationStateTest : public ::testing::Test {
+ protected:
+ static std::vector<StateID> added_states_;
+ ApplicationState app_state;
+ const StateID current_id = StateID::STATE_ID_CURRENT;
+ const StateID postponed_id = StateID::STATE_ID_POSTPONED;
+ const uint32_t app_id = 10;
+ MockApplicationManager app_mngr_;
+};
+
+std::vector<StateID> ApplicationStateTest::added_states_ =
+ GenerateCurrentStates();
+
+TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
+ std::vector<StateID>::iterator new_state = added_states_.begin();
+ for (; new_state != added_states_.end(); ++new_state) {
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+ EXPECT_EQ(state, app_state.GetState(current_id));
+ }
+}
+
+TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
+ std::vector<StateID>::iterator new_state = added_states_.begin();
+ for (; new_state != added_states_.end(); ++new_state) {
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+
+ HmiStatePtr curr_state = app_state.GetState(current_id);
+ ASSERT_EQ(*new_state, curr_state->state_id());
+ }
+
+ new_state = added_states_.end() - 1;
+ while (new_state != added_states_.begin()) {
+ app_state.RemoveState(*new_state);
+ HmiStatePtr curr_state = app_state.GetState(current_id);
+ --new_state;
+ EXPECT_EQ(*new_state, curr_state->state_id());
+ }
+}
+
+TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
+ // Added some states
+ std::vector<StateID>::iterator new_state = added_states_.begin();
+ for (; new_state != added_states_.end(); ++new_state) {
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+ }
+ // Postponed state wasn't added
+ HmiStatePtr get_postponed_id = app_state.GetState(postponed_id);
+ EXPECT_EQ(NULL, get_postponed_id);
+ // Add posponed state
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id);
+ app_state.AddState(state);
+ // Postponed state exists
+ get_postponed_id = app_state.GetState(postponed_id);
+ EXPECT_EQ(state, get_postponed_id);
+}
+
+TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
+ // Add state
+ std::vector<StateID>::iterator new_state = added_states_.begin();
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ state->set_hmi_level(HMILevel::HMI_FULL);
+ app_state.AddState(state);
+ ++new_state;
+ // Add some other
+ for (; new_state != added_states_.end(); ++new_state) {
+ state = utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+ state->set_hmi_level(HMILevel::HMI_LIMITED);
+ }
+
+ // Regular state will be the first added state
+ new_state = added_states_.begin();
+ HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ EXPECT_EQ(*new_state, reg_state->state_id());
+ EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
+}
+
+TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
+ std::vector<StateID>::iterator new_state = added_states_.begin();
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+ ++new_state;
+
+ // Add postponed state
+ state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id);
+ app_state.AddState(state);
+
+ // Make sure that the state was added
+ HmiStatePtr post_state = app_state.GetState(postponed_id);
+ ASSERT_EQ(state, post_state);
+
+ for (; new_state != added_states_.end(); ++new_state) {
+ state = utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state);
+ app_state.AddState(state);
+ }
+
+ // Regular state will be the first added state
+ new_state = added_states_.begin();
+ HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ ASSERT_EQ(*new_state, reg_state->state_id());
+
+ app_state.RemoveState(*new_state);
+
+ ++new_state;
+ // Now regular state is the next state except postponed
+ reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ EXPECT_EQ(*new_state, reg_state->state_id());
+}
+
+TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
+ // Add some state
+ StateID first_state = StateID::STATE_ID_PHONE_CALL;
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, first_state);
+ app_state.AddState(state);
+
+ // Add postponed state
+ state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id);
+ app_state.AddState(state);
+
+ // Add new postponed state
+ const uint32_t app_id2 = 10;
+ state = utils::MakeShared<HmiState>(app_id2, app_mngr_, postponed_id);
+ app_state.AddState(state);
+
+ // Add regular state
+ state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, StateID::STATE_ID_REGULAR);
+ app_state.AddState(state);
+
+ // Postponed state is the first
+ HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_POSTPONED);
+ ASSERT_EQ(postponed_id, reg_state->state_id());
+
+ // Regular state is the second one
+ reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
+}
+
+TEST_F(ApplicationStateTest, InitState_GetRegularState) {
+ StateID init_state = StateID::STATE_ID_REGULAR;
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, init_state);
+
+ app_state.InitState(state);
+
+ HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ EXPECT_EQ(state, reg_state);
+
+ HmiStatePtr curr_state = app_state.GetState(StateID::STATE_ID_CURRENT);
+ EXPECT_EQ(state, curr_state);
+}
+
+TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
+ // Precondition
+ StateID init_state = StateID::STATE_ID_REGULAR;
+ HmiStatePtr state =
+ utils::MakeShared<HmiState>(app_id, app_mngr_, init_state);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+
+ app_state.InitState(state);
+
+ // Add postponed state
+ state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id);
+ app_state.AddState(state);
+
+ // Make sure that state was added
+ HmiStatePtr get_postponed_state = app_state.GetState(postponed_id);
+ ASSERT_EQ(state, get_postponed_state);
+
+ // Remove postponed state
+ app_state.RemoveState(postponed_id);
+
+ get_postponed_state = app_state.GetState(postponed_id);
+ EXPECT_EQ(NULL, get_postponed_state);
+}
+
+TEST_F(ApplicationStateTest,
+ AddRegularState_RemoveRegularState_RegularStateNotDeleted) {
+ StateID reg_state = StateID::STATE_ID_REGULAR;
+ HmiStatePtr state = utils::MakeShared<HmiState>(app_id, app_mngr_, reg_state);
+ app_state.InitState(state);
+
+ // Try deleting regular state
+ app_state.RemoveState(reg_state);
+
+ // Get regular state
+ HmiStatePtr get_reg_state = app_state.GetState(reg_state);
+ EXPECT_EQ(state, get_reg_state);
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
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/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
new file mode 100644
index 0000000000..35755a08bb
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -0,0 +1,124 @@
+/*
+ * 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/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "mobile/subscribe_way_points_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::DoAll;
+using ::testing::SaveArg;
+using ::testing::InSequence;
+namespace am = ::application_manager;
+using am::commands::SubscribeWayPointsRequest;
+using am::commands::MessageSharedPtr;
+
+typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr;
+
+class SubscribeWayPointsRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef TypeIf<kMocksIsNice,
+ NiceMock<application_manager_test::MockHMICapabilities>,
+ application_manager_test::MockHMICapabilities>::Result
+ MockHMICapabilities;
+};
+
+TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
+ CommandPtr command(CreateCommand<SubscribeWayPointsRequest>());
+ MockAppPtr app(CreateMockApp());
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(_))
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
+ .WillByDefault(Return(true));
+
+ {
+ InSequence dummy;
+ EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_));
+ EXPECT_CALL(*app, UpdateHash());
+ }
+
+ MessageSharedPtr mobile_result_msg(
+ CatchMobileCommandResult(CallRun(*command)));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code].asInt()));
+}
+
+TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
+ CommandPtr command(CreateCommand<SubscribeWayPointsRequest>());
+ MockAppPtr app(CreateMockApp());
+ Event event(hmi_apis::FunctionID::Navigation_SubscribeWayPoints);
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ event.set_smart_object(*event_msg);
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ {
+ InSequence dummy;
+ EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_));
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
+ EXPECT_CALL(*app, UpdateHash());
+ }
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
new file mode 100644
index 0000000000..0a5ff9745b
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -0,0 +1,99 @@
+/*
+ * 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/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "mobile/unsubscribe_way_points_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::DoAll;
+using ::testing::SaveArg;
+using ::testing::InSequence;
+namespace am = ::application_manager;
+using am::commands::UnSubscribeWayPointsRequest;
+using am::commands::MessageSharedPtr;
+
+typedef SharedPtr<UnSubscribeWayPointsRequest> CommandPtr;
+
+class UnsubscribeWayPointsRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef TypeIf<kMocksIsNice,
+ NiceMock<application_manager_test::MockHMICapabilities>,
+ application_manager_test::MockHMICapabilities>::Result
+ MockHMICapabilities;
+};
+
+TEST_F(UnsubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
+ CommandPtr command(CreateCommand<UnSubscribeWayPointsRequest>());
+ MockAppPtr app(CreateMockApp());
+ Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ event.set_smart_object(*event_msg);
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ {
+ InSequence dummy;
+ EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(_));
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
+ EXPECT_CALL(*app, UpdateHash());
+ }
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
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..e88dd2ba4e
--- /dev/null
+++ b/src/components/application_manager/test/event_engine_test.cc
@@ -0,0 +1,183 @@
+/*
+ * 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 "application_manager/event_engine/event_observer.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "application_manager/event_observer_mock.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
+#include "utils/make_shared.h"
+#include "interfaces/HMI_API.h"
+
+namespace test {
+namespace components {
+namespace event_engine_test {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+using application_manager::event_engine::EventDispatcherImpl;
+using application_manager::event_engine::Event;
+using application_manager::event_engine::EventObserver;
+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)
+ , event_observer_mock_(mock_event_dispatcher_) {}
+
+ 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;
+ MockEventDispatcher mock_event_dispatcher_;
+ 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 {
+ event_dispatcher_instance_ = new EventDispatcherImpl();
+ 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;
+ }
+
+ void TearDown() OVERRIDE {
+ delete event_dispatcher_instance_;
+ 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..c174dfcba4
--- /dev/null
+++ b/src/components/application_manager/test/hmi_capabilities.json
@@ -0,0 +1,466 @@
+{
+ "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"
+ },
+ "pcmStreamCapabilities":
+ {
+ "samplingRate" : "16KHZ",
+ "bitsPerSample" : "RATE_16_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/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
new file mode 100644
index 0000000000..1ed2123eba
--- /dev/null
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -0,0 +1,527 @@
+/*
+ * 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_capabilities.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/mock_message_helper.h"
+#include "smart_objects/enum_schema_item.h"
+#include "interfaces/HMI_API.h"
+#include "utils/make_shared.h"
+#include "application_manager/hmi_capabilities_for_testing.h"
+#include "utils/file_system.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/state_controller.h"
+#include "resumption/last_state.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::AtLeast;
+using ::testing::Invoke;
+using ::testing::InSequence;
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+using namespace application_manager;
+
+class HMICapabilitiesTest : public ::testing::Test {
+ protected:
+ HMICapabilitiesTest() : last_state_("app_storage_folder", "app_info_data") {}
+ virtual void SetUp() OVERRIDE {
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher));
+ EXPECT_CALL(app_mngr_, get_settings())
+ .WillRepeatedly(ReturnRef(mock_application_manager_settings_));
+ EXPECT_CALL(mock_application_manager_settings_,
+ hmi_capabilities_file_name()).WillOnce(ReturnRef(kFileName));
+ EXPECT_CALL(mock_event_dispatcher, add_observer(_, _, _)).Times(1);
+ EXPECT_CALL(mock_event_dispatcher, remove_observer(_)).Times(1);
+ EXPECT_CALL(mock_application_manager_settings_, launch_hmi())
+ .WillOnce(Return(false));
+ hmi_capabilities_test =
+ utils::MakeShared<HMICapabilitiesForTesting>(app_mngr_);
+ hmi_capabilities_test->Init(&last_state_);
+ }
+
+ void TearDown() OVERRIDE {
+ hmi_capabilities_test.reset();
+ }
+ static void TearDownTestCase() {
+ if (file_system::FileExists("./app_info_data")) {
+ EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ }
+ }
+
+ void SetCooperating();
+ MockApplicationManager app_mngr_;
+ event_engine_test::MockEventDispatcher mock_event_dispatcher;
+ resumption::LastState last_state_;
+ MockApplicationManagerSettings mock_application_manager_settings_;
+ utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities_test;
+ const std::string kFileName = "hmi_capabilities.json";
+};
+
+const char* const cstring_values_[] = {
+ "EN_US", "ES_MX", "FR_CA", "DE_DE", "ES_ES", "EN_GB", "RU_RU", "TR_TR",
+ "PL_PL", "FR_FR", "IT_IT", "SV_SE", "PT_PT", "NL_NL", "EN_AU", "ZH_CN",
+ "ZH_TW", "JA_JP", "AR_SA", "KO_KR", "PT_BR", "CS_CZ", "DA_DK", "NO_NO",
+ "NL_BE", "EL_GR", "HU_HU", "FI_FI", "SK_SK"};
+
+const hmi_apis::Common_Language::eType enum_values_[] = {
+ hmi_apis::Common_Language::EN_US, hmi_apis::Common_Language::ES_MX,
+ hmi_apis::Common_Language::FR_CA, hmi_apis::Common_Language::DE_DE,
+ hmi_apis::Common_Language::ES_ES, hmi_apis::Common_Language::EN_GB,
+ hmi_apis::Common_Language::RU_RU, hmi_apis::Common_Language::TR_TR,
+ hmi_apis::Common_Language::PL_PL, hmi_apis::Common_Language::FR_FR,
+ hmi_apis::Common_Language::IT_IT, hmi_apis::Common_Language::SV_SE,
+ hmi_apis::Common_Language::PT_PT, hmi_apis::Common_Language::NL_NL,
+ hmi_apis::Common_Language::EN_AU, hmi_apis::Common_Language::ZH_CN,
+ hmi_apis::Common_Language::ZH_TW, hmi_apis::Common_Language::JA_JP,
+ hmi_apis::Common_Language::AR_SA, hmi_apis::Common_Language::KO_KR,
+ hmi_apis::Common_Language::PT_BR, hmi_apis::Common_Language::CS_CZ,
+ hmi_apis::Common_Language::DA_DK, hmi_apis::Common_Language::NO_NO,
+ hmi_apis::Common_Language::NL_BE, hmi_apis::Common_Language::EL_GR,
+ hmi_apis::Common_Language::HU_HU, hmi_apis::Common_Language::FI_FI,
+ hmi_apis::Common_Language::SK_SK};
+
+struct CStringComparator {
+ bool operator()(const char* a, const char* b) {
+ return strcmp(a, b) < 0;
+ }
+};
+
+typedef std::map<const char*,
+ hmi_apis::Common_Language::eType,
+ CStringComparator> CStringToEnumMap;
+
+CStringToEnumMap InitCStringToEnumMap() {
+ size_t value = sizeof(cstring_values_) / sizeof(cstring_values_[0]);
+ CStringToEnumMap result;
+ for (size_t i = 0; i < value; ++i) {
+ result[cstring_values_[i]] = enum_values_[i];
+ }
+ return result;
+}
+
+bool StringToEnum(const char* str, hmi_apis::Common_Language::eType& value) {
+ size_t count_value = sizeof(cstring_values_) / sizeof(cstring_values_[0]);
+ CStringToEnumMap result;
+ for (size_t i = 0; i < count_value; ++i) {
+ result[cstring_values_[i]] = enum_values_[i];
+ }
+
+ CStringToEnumMap::const_iterator it = result.find(str);
+ if (it == result.end()) {
+ return false;
+ }
+ value = it->second;
+ return true;
+}
+
+hmi_apis::Common_Language::eType TestCommonLanguageFromString(
+ const std::string& language) {
+ hmi_apis::Common_Language::eType value;
+ if (StringToEnum(language.c_str(), value)) {
+ return value;
+ }
+ return hmi_apis::Common_Language::INVALID_ENUM;
+}
+
+TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
+ const std::string hmi_capabilities_file = "hmi_capabilities.json";
+ EXPECT_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillOnce(ReturnRef(hmi_capabilities_file));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(_))
+ .WillRepeatedly(Invoke(TestCommonLanguageFromString));
+
+ if (file_system::FileExists("./app_info_data")) {
+ EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ }
+ EXPECT_TRUE(hmi_capabilities_test->LoadCapabilitiesFromFile());
+
+ // Check active languages
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ hmi_capabilities_test->active_ui_language());
+ EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
+ hmi_capabilities_test->active_vr_language());
+ EXPECT_EQ(hmi_apis::Common_Language::DE_DE,
+ hmi_capabilities_test->active_tts_language());
+
+ // Check UI languages
+ const smart_objects::SmartObject ui_supported_languages =
+ *(hmi_capabilities_test->ui_supported_languages());
+
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ static_cast<hmi_apis::Common_Language::eType>(
+ ui_supported_languages[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
+ static_cast<hmi_apis::Common_Language::eType>(
+ ui_supported_languages[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::FR_CA,
+ static_cast<hmi_apis::Common_Language::eType>(
+ ui_supported_languages[2].asInt()));
+
+ // Check VR languages
+ const smart_objects::SmartObject vr_supported_languages =
+ *(hmi_capabilities_test->vr_supported_languages());
+
+ EXPECT_EQ(hmi_apis::Common_Language::AR_SA,
+ static_cast<hmi_apis::Common_Language::eType>(
+ vr_supported_languages[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ static_cast<hmi_apis::Common_Language::eType>(
+ vr_supported_languages[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
+ static_cast<hmi_apis::Common_Language::eType>(
+ vr_supported_languages[2].asInt()));
+
+ // Check TTS languages
+ const smart_objects::SmartObject tts_supported_languages =
+ *(hmi_capabilities_test->tts_supported_languages());
+
+ EXPECT_EQ(hmi_apis::Common_Language::DA_DK,
+ static_cast<hmi_apis::Common_Language::eType>(
+ tts_supported_languages[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::CS_CZ,
+ static_cast<hmi_apis::Common_Language::eType>(
+ tts_supported_languages[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::KO_KR,
+ static_cast<hmi_apis::Common_Language::eType>(
+ tts_supported_languages[2].asInt()));
+
+ // Check button capabilities
+ const smart_objects::SmartObject buttons_capabilities_so =
+ *(hmi_capabilities_test->button_capabilities());
+
+ // Count of buttons in json file
+ const uint32_t btn_length = buttons_capabilities_so.length();
+ EXPECT_EQ(15u, btn_length);
+ for (uint32_t i = 0; i < btn_length; ++i) {
+ EXPECT_TRUE((buttons_capabilities_so[i]).keyExists(strings::name));
+ EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("shortPressAvailable"));
+ EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("longPressAvailable"));
+ EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("upDownAvailable"));
+ EXPECT_TRUE(buttons_capabilities_so[i]["shortPressAvailable"].asBool());
+ EXPECT_TRUE(buttons_capabilities_so[i]["longPressAvailable"].asBool());
+ EXPECT_TRUE(buttons_capabilities_so[i]["upDownAvailable"].asBool());
+ }
+ const smart_objects::SmartObject display_capabilities_so =
+ *(hmi_capabilities_test->display_capabilities());
+
+ // Check display type
+ EXPECT_EQ(hmi_apis::Common_DisplayType::GEN2_8_DMA,
+ static_cast<hmi_apis::Common_DisplayType::eType>(
+ display_capabilities_so[hmi_response::display_type].asInt()));
+
+ EXPECT_TRUE(display_capabilities_so["graphicSupported"].asBool());
+
+ // Check text fields
+ const uint32_t text_len =
+ display_capabilities_so[hmi_response::text_fields].length();
+ EXPECT_NE(0u, text_len);
+ for (uint32_t i = 0; i < text_len; ++i) {
+ EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][i])
+ .keyExists(strings::name));
+ EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][i])
+ .keyExists(strings::character_set));
+ }
+
+ // Check image fields
+ EXPECT_TRUE((display_capabilities_so).keyExists(hmi_response::image_fields));
+ const uint32_t img_len =
+ display_capabilities_so[hmi_response::image_fields].length();
+ EXPECT_NE(0u, img_len);
+ for (uint32_t i = 0; i < img_len; ++i) {
+ EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][i])
+ .keyExists(strings::name));
+ EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][i])
+ .keyExists(strings::image_type_supported));
+ if (display_capabilities_so[hmi_response::image_fields][i][strings::name] ==
+ hmi_apis::Common_ImageFieldName::locationImage) {
+ EXPECT_EQ(hmi_apis::Common_FileType::GRAPHIC_PNG,
+ static_cast<hmi_apis::Common_FileType::eType>(
+ display_capabilities_so[hmi_response::image_fields][i]
+ [strings::image_type_supported][0]
+ .asInt()));
+ }
+ }
+
+ // Check media clock formats
+ EXPECT_TRUE(
+ (display_capabilities_so).keyExists(hmi_response::media_clock_formats));
+ const uint32_t media_length =
+ display_capabilities_so[hmi_response::media_clock_formats].length();
+ EXPECT_NE(0u, media_length);
+ for (uint32_t i = 0; i < media_length; ++i) {
+ EXPECT_EQ(
+ i,
+ display_capabilities_so[hmi_response::media_clock_formats][i].asUInt());
+ }
+
+ EXPECT_TRUE(
+ (display_capabilities_so).keyExists(hmi_response::image_capabilities));
+ EXPECT_EQ(hmi_apis::Common_ImageType::DYNAMIC,
+ static_cast<hmi_apis::Common_ImageType::eType>(
+ display_capabilities_so[hmi_response::image_capabilities][0]
+ .asInt()));
+ EXPECT_EQ(hmi_apis::Common_ImageType::STATIC,
+ static_cast<hmi_apis::Common_ImageType::eType>(
+ display_capabilities_so[hmi_response::image_capabilities][1]
+ .asInt()));
+
+ // Check audio pass thru
+ const smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ *(hmi_capabilities_test->audio_pass_thru_capabilities());
+ EXPECT_EQ(hmi_apis::Common_SamplingRate::RATE_44KHZ,
+ static_cast<hmi_apis::Common_SamplingRate::eType>(
+ audio_pass_thru_capabilities_so["samplingRate"].asInt()));
+ EXPECT_EQ(hmi_apis::Common_BitsPerSample::RATE_8_BIT,
+ static_cast<hmi_apis::Common_BitsPerSample::eType>(
+ audio_pass_thru_capabilities_so["bitsPerSample"].asInt()));
+ EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
+ static_cast<hmi_apis::Common_AudioType::eType>(
+ audio_pass_thru_capabilities_so["audioType"].asInt()));
+
+ // Check hmi zone capabilities
+ const smart_objects::SmartObject hmi_zone_capabilities_so =
+ *(hmi_capabilities_test->hmi_zone_capabilities());
+ EXPECT_EQ(hmi_apis::Common_HmiZoneCapabilities::FRONT,
+ static_cast<hmi_apis::Common_HmiZoneCapabilities::eType>(
+ hmi_zone_capabilities_so.asInt()));
+
+ const smart_objects::SmartObject soft_button_capabilities_so =
+ *(hmi_capabilities_test->soft_button_capabilities());
+
+ EXPECT_TRUE(soft_button_capabilities_so[0]["shortPressAvailable"].asBool());
+ EXPECT_TRUE(soft_button_capabilities_so[0]["longPressAvailable"].asBool());
+ EXPECT_TRUE(soft_button_capabilities_so[0]["upDownAvailable"].asBool());
+ EXPECT_TRUE(soft_button_capabilities_so[0]["imageSupported"].asBool());
+
+ const smart_objects::SmartObject preset_bank_so =
+ *(hmi_capabilities_test->preset_bank_capabilities());
+ EXPECT_TRUE(preset_bank_so["onScreenPresetsAvailable"].asBool());
+
+ // Check vehicle type
+ const smart_objects::SmartObject vehicle_type_so =
+ *(hmi_capabilities_test->vehicle_type());
+ EXPECT_TRUE(preset_bank_so["onScreenPresetsAvailable"].asBool());
+
+ EXPECT_EQ("Ford", vehicle_type_so["make"].asString());
+ EXPECT_EQ("Fiesta", vehicle_type_so["model"].asString());
+ EXPECT_EQ("2013", vehicle_type_so["modelYear"].asString());
+ EXPECT_EQ("SE", vehicle_type_so["trim"].asString());
+}
+
+TEST_F(HMICapabilitiesTest, ConvertJsonLanguagesToObj) {
+ Json::Value json_languages(Json::arrayValue);
+ json_languages[0] = "EN_US";
+ json_languages[1] = "ES_MX";
+ smart_objects::SmartObject sm_obj =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(json_languages[0].asString()))
+ .WillOnce(Return(hmi_apis::Common_Language::EN_US));
+
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(json_languages[1].asString()))
+ .WillOnce(Return(hmi_apis::Common_Language::ES_MX));
+
+ hmi_capabilities_test->ConvertJsonLanguagesToObj(json_languages, sm_obj);
+
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ static_cast<hmi_apis::Common_Language::eType>(sm_obj[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
+ static_cast<hmi_apis::Common_Language::eType>(sm_obj[1].asInt()));
+}
+
+TEST_F(HMICapabilitiesTest,
+ HmiCapabilitiesInitialized_UiVrTtsIviNotCooperating) {
+ // Precondition
+ hmi_capabilities_test->set_is_vr_cooperating(false);
+ hmi_capabilities_test->set_is_tts_cooperating(false);
+
+ hmi_capabilities_test->set_is_ui_cooperating(false);
+ hmi_capabilities_test->set_is_navi_cooperating(false);
+ hmi_capabilities_test->set_is_ivi_cooperating(false);
+ EXPECT_TRUE(hmi_capabilities_test->is_hmi_capabilities_initialized());
+}
+
+TEST_F(HMICapabilitiesTest, HmiCapabilitiesInitialized) {
+ // Precondition
+ SetCooperating();
+ smart_objects::SmartObjectSPtr language(
+ new smart_objects::SmartObject(smart_objects::SmartType_Map));
+
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(_, _)).WillRepeatedly(Return(language));
+
+ hmi_capabilities_test->set_is_vr_cooperating(true);
+ smart_objects::SmartObject supported_languages;
+ supported_languages[0] = "EN_US";
+ hmi_capabilities_test->set_vr_supported_languages(supported_languages);
+ hmi_capabilities_test->set_tts_supported_languages(supported_languages);
+ hmi_capabilities_test->set_ui_supported_languages(supported_languages);
+ hmi_capabilities_test->set_vehicle_type(supported_languages);
+
+ hmi_capabilities_test->set_is_tts_cooperating(true);
+ hmi_capabilities_test->set_is_ui_cooperating(true);
+ hmi_capabilities_test->set_is_navi_cooperating(true);
+ hmi_capabilities_test->set_is_ivi_cooperating(true);
+
+ hmi_capabilities_test->set_active_vr_language(
+ hmi_apis::Common_Language::EN_US);
+ SetCooperating();
+ hmi_capabilities_test->set_active_tts_language(
+ hmi_apis::Common_Language::EN_US);
+ SetCooperating();
+ hmi_capabilities_test->set_active_ui_language(
+ hmi_apis::Common_Language::EN_US);
+
+ EXPECT_TRUE(hmi_capabilities_test->is_hmi_capabilities_initialized());
+}
+
+TEST_F(HMICapabilitiesTest, VerifyImageType) {
+ const int32_t image_type = 1;
+ smart_objects::SmartObject sm_obj;
+ sm_obj[hmi_response::image_capabilities][0] = image_type;
+ hmi_capabilities_test->set_display_capabilities(sm_obj);
+
+ EXPECT_TRUE(hmi_capabilities_test->VerifyImageType(image_type));
+
+ const int32_t new_image_type = 2;
+ EXPECT_FALSE(hmi_capabilities_test->VerifyImageType(new_image_type));
+}
+
+void HMICapabilitiesTest::SetCooperating() {
+ smart_objects::SmartObjectSPtr test_so;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(_, _)).WillRepeatedly(Return(test_so));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillRepeatedly(Return(true));
+}
+
+TEST_F(HMICapabilitiesTest, SetVRCooperating) {
+ // Without sequence it is impossible to check correct call of ManageHMICommand
+ InSequence dummy;
+ smart_objects::SmartObjectSPtr language(
+ new smart_objects::SmartObject(smart_objects::SmartType_Map));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _))
+ .WillOnce(Return(language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(language));
+
+ smart_objects::SmartObjectSPtr support_language;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ _)).WillOnce(Return(support_language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(support_language));
+
+ smart_objects::SmartObjectSPtr capabilities;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _))
+ .WillOnce(Return(capabilities));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
+
+ hmi_capabilities_test->set_is_vr_cooperating(true);
+}
+
+TEST_F(HMICapabilitiesTest, SetTTSCooperating) {
+ smart_objects::SmartObjectSPtr language(
+ new smart_objects::SmartObject(smart_objects::SmartType_Map));
+ InSequence dummy;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, _))
+ .WillOnce(Return(language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(language));
+
+ smart_objects::SmartObjectSPtr support_language;
+ EXPECT_CALL(
+ *(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetSupportedLanguages, _))
+ .WillOnce(Return(support_language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(support_language));
+
+ smart_objects::SmartObjectSPtr capabilities;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetCapabilities, _))
+ .WillOnce(Return(capabilities));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
+
+ hmi_capabilities_test->set_is_tts_cooperating(true);
+}
+
+TEST_F(HMICapabilitiesTest, SetUICooperating) {
+ InSequence dummy;
+ smart_objects::SmartObjectSPtr language(
+ new smart_objects::SmartObject(smart_objects::SmartType_Map));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage, _))
+ .WillOnce(Return(language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(language));
+
+ smart_objects::SmartObjectSPtr support_language;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ _)).WillOnce(Return(support_language));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(support_language));
+
+ smart_objects::SmartObjectSPtr capabilities;
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetCapabilities, _))
+ .WillOnce(Return(capabilities));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
+
+ hmi_capabilities_test->set_is_ui_cooperating(true);
+}
+
+TEST_F(HMICapabilitiesTest, SetIviCooperating) {
+ smart_objects::SmartObjectSPtr ivi_type;
+ EXPECT_CALL(
+ *(MockMessageHelper::message_helper_mock()),
+ CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _))
+ .WillOnce(Return(ivi_type));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(ivi_type));
+
+ hmi_capabilities_test->set_is_ivi_cooperating(true);
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/state_controller/include/application_manager_mock.h b/src/components/application_manager/test/include/application_manager/application_manager_mock.h
index 22ff93687a..35f5f4dbdb 100644
--- a/src/components/application_manager/test/state_controller/include/application_manager_mock.h
+++ b/src/components/application_manager/test/include/application_manager/application_manager_mock.h
@@ -37,13 +37,18 @@
#include "gmock/gmock.h"
#include "application_manager/application_manager.h"
#include "application_manager/usage_statistics.h"
-
+#include "application_manager/commands/command.h"
+#include "media_manager/media_manager.h"
+#include "resumption/last_state.h"
+#include "application_manager/policies/policy_handler.h"
+namespace test {
+namespace components {
namespace state_controller_test {
namespace am = application_manager;
class ApplicationManagerMock : public application_manager::ApplicationManager {
public:
- MOCK_METHOD0(Init, bool());
+ MOCK_METHOD1(Init, bool(resumption::LastState& last_state));
MOCK_METHOD0(Stop, bool());
MOCK_METHOD1(set_hmi_message_handler,
@@ -52,10 +57,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 +69,44 @@ 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));
+ MOCK_METHOD2(SendMessageToMobile,
+ void(const smart_objects::SmartObjectSPtr message,
+ bool final_message));
+ MOCK_METHOD1(SendMessageToMobile,
+ void(const smart_objects::SmartObjectSPtr message));
+ MOCK_METHOD1(SendMessageToHMI,
+ void(const smart_objects::SmartObjectSPtr message));
+ MOCK_METHOD2(ManageMobileCommand,
+ bool(const smart_objects::SmartObjectSPtr message,
+ am::commands::Command::CommandOrigin origin));
+ MOCK_METHOD1(ManageHMICommand,
+ bool(const smart_objects::SmartObjectSPtr message));
+ MOCK_CONST_METHOD2(CanAppStream,
+ bool(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id));
+ MOCK_METHOD2(SendAudioPassThroughNotification,
+ void(uint32_t session_key, std::vector<uint8_t>& binary_data));
+ MOCK_CONST_METHOD0(connection_handler,
+ connection_handler::ConnectionHandler&());
};
} // 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/include/application_manager/application_mock.h
index 01dafd10f4..9896ecfdd4 100644
--- a/src/components/application_manager/test/state_controller/include/application_mock.h
+++ b/src/components/application_manager/test/include/application_manager/application_mock.h
@@ -37,120 +37,22 @@
#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 {
- 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 am::Version&());
- MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id));
+namespace am = application_manager;
- 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, 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));
- 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));
- 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,
- 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));
- 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());
+namespace custom_str = utils::custom_string;
- // InitialApplicationData methods
+class MockApplication : public application_manager::Application {
+ public:
+ // InitialApplicationData
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(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*());
@@ -160,7 +62,7 @@ class ApplicationMock : public am::Application {
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_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));
@@ -169,7 +71,7 @@ class ApplicationMock : public am::Application {
MOCK_METHOD1(set_ui_language,
void(const mobile_apis::Language::eType& ui_language));
- // DynamicApplicationData methods
+ // 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*());
@@ -178,9 +80,10 @@ class ApplicationMock : public am::Application {
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>());
+ 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*());
@@ -213,8 +116,9 @@ class ApplicationMock : public am::Application {
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_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,
@@ -230,23 +134,147 @@ class ApplicationMock : public am::Application {
MOCK_METHOD1(FindChoiceSet,
smart_objects::SmartObject*(uint32_t choice_set_id));
MOCK_METHOD3(AddPerformInteractionChoiceSet,
- void(uint32_t correlation_id, uint32_t choice_set_id,
+ 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>());
+ 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));
+ MOCK_METHOD1(StartStreaming,
+ 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));
+ 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(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_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 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));
+ 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_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 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/include/application_manager/event_observer_mock.h b/src/components/application_manager/test/include/application_manager/event_observer_mock.h
new file mode 100644
index 0000000000..3d3d72c5ab
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/event_observer_mock.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_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 test {
+namespace components {
+namespace event_engine_test {
+
+class MockEventObserver
+ : public application_manager::event_engine::EventObserver {
+ public:
+ MockEventObserver(
+ ::application_manager::event_engine::EventDispatcher& event_dispatcher)
+ : application_manager::event_engine::EventObserver(event_dispatcher) {}
+ MOCK_METHOD1(on_event,
+ void(const application_manager::event_engine::Event& event));
+};
+
+} // namespace event_engine_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_EVENT_OBSERVER_MOCK_H_
diff --git a/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h b/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h
new file mode 100644
index 0000000000..ec8e92e859
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h
@@ -0,0 +1,62 @@
+/*
+ * 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_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
+
+#include "application_manager/hmi_capabilities.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class HMICapabilitiesForTesting
+ : public ::application_manager::HMICapabilities {
+ public:
+ HMICapabilitiesForTesting(::application_manager::ApplicationManager& app_mngr)
+ : HMICapabilities(app_mngr) {}
+ bool LoadCapabilitiesFromFile() {
+ return load_capabilities_from_file();
+ }
+
+ void ConvertJsonLanguagesToObj(
+ Json::Value& json_languages,
+ ::NsSmartDeviceLink::NsSmartObjects::SmartObject& languages) {
+ convert_json_languages_to_obj(json_languages, languages);
+ }
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
diff --git a/src/components/application_manager/test/resumption/include/application_mock.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 39c4b33539..066ad9baae 100644
--- a/src/components/application_manager/test/resumption/include/application_mock.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.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
@@ -29,18 +29,23 @@
* 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_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_H_
#include <string>
#include "gmock/gmock.h"
#include "application_manager/application.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
-namespace resumption_test {
+namespace application_manager_test {
-class ApplicationMock : public ::application_manager::Application {
+namespace custom_str = utils::custom_string;
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+class MockApplication : public ::application_manager::Application {
public:
+ MockApplication() {}
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
@@ -65,6 +70,8 @@ class ApplicationMock : public ::application_manager::Application {
MOCK_METHOD1(StartStreaming,
void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(StopStreamingForce,
+ void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(SuspendStreaming,
void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(WakeUpStreaming,
@@ -78,7 +85,7 @@ class ApplicationMock : public ::application_manager::Application {
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_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());
@@ -91,26 +98,23 @@ class ApplicationMock : public ::application_manager::Application {
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(CurrentHmiState, const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr());
MOCK_CONST_METHOD0(PostponedHmiState,
- ::application_manager::HmiStatePtr());
+ const 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_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_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));
@@ -125,8 +129,9 @@ class ApplicationMock : public ::application_manager::Application {
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(
+ GetFile,
+ const ::application_manager::AppFile*(const std::string& file_name));
MOCK_METHOD1(SubscribeToButton,
bool(mobile_apis::ButtonName::eType btn_name));
MOCK_METHOD1(IsSubscribedToButton,
@@ -142,7 +147,9 @@ class ApplicationMock : public ::application_manager::Application {
::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(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));
@@ -184,10 +191,10 @@ class ApplicationMock : public ::application_manager::Application {
MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(
SubscribedButtons,
- DataAccessor< ::application_manager::ButtonSubscriptions >());
+ DataAccessor< ::application_manager::ButtonSubscriptions>());
MOCK_CONST_METHOD0(
SubscribedIVI,
- DataAccessor< ::application_manager::VehicleInfoSubscriptions >());
+ 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*());
@@ -220,8 +227,9 @@ class ApplicationMock : public ::application_manager::Application {
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_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,
@@ -237,30 +245,41 @@ class ApplicationMock : public ::application_manager::Application {
MOCK_METHOD1(FindChoiceSet,
smart_objects::SmartObject*(uint32_t choice_set_id));
MOCK_METHOD3(AddPerformInteractionChoiceSet,
- void(uint32_t correlation_id, uint32_t choice_set_id,
+ 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 >());
+ DataAccessor< ::application_manager::PerformChoiceSetMap>());
MOCK_CONST_METHOD0(commands_map,
- DataAccessor< ::application_manager::CommandsMap >());
+ DataAccessor< ::application_manager::CommandsMap>());
MOCK_CONST_METHOD0(sub_menu_map,
- DataAccessor< ::application_manager::SubMenuMap >());
+ DataAccessor< ::application_manager::SubMenuMap>());
MOCK_CONST_METHOD0(choice_set_map,
- DataAccessor< ::application_manager::ChoiceSetMap >());
+ 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_perform_interaction_layout,
+ void(mobile_apis::LayoutMode::eType mode));
+ MOCK_CONST_METHOD0(perform_interaction_layout,
+ mobile_apis::LayoutMode::eType());
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());
+ MOCK_CONST_METHOD0(mac_address, const std::string&());
+ MOCK_METHOD0(GetAvailableDiskSpace, uint32_t());
+ MOCK_METHOD1(set_mobile_app_id, void(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(is_foreground, bool());
+ MOCK_METHOD1(set_foreground, void(bool is_foreground));
+ MOCK_CONST_METHOD0(IsRegistered, bool());
};
-} // namespace resumption_test
+} // namespace application_manager_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_RESUMPTION_INCLUDE_APPLICATION_MOCK_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_application_manager.h b/src/components/application_manager/test/include/application_manager/mock_application_manager.h
new file mode 100644
index 0000000000..6ad8aeb250
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_application_manager.h
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "application_manager/application_manager.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/vehicle_info_data.h"
+#include "application_manager/state_controller.h"
+#include "resumption/last_state.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+
+class MockApplicationManager : public application_manager::ApplicationManager {
+ public:
+ MOCK_METHOD2(Init,
+ bool(resumption::LastState& last_state,
+ media_manager::MediaManager* media_manager));
+ MOCK_METHOD0(Stop, bool());
+ MOCK_METHOD1(set_hmi_message_handler,
+ void(hmi_message_handler::HMIMessageHandler* handler));
+ MOCK_METHOD1(set_protocol_handler,
+ void(protocol_handler::ProtocolHandler* handler));
+ MOCK_METHOD1(set_connection_handler,
+ void(connection_handler::ConnectionHandler* handler));
+ MOCK_CONST_METHOD0(applications,
+ DataAccessor<application_manager::ApplicationSet>());
+ MOCK_CONST_METHOD1(
+ application, application_manager::ApplicationSharedPtr(uint32_t app_id));
+ MOCK_CONST_METHOD0(active_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD1(
+ application_by_hmi_app,
+ application_manager::ApplicationSharedPtr(uint32_t hmi_app_id));
+ MOCK_CONST_METHOD1(application_by_policy_id,
+ application_manager::ApplicationSharedPtr(
+ const std::string& policy_app_id));
+ MOCK_METHOD1(
+ applications_by_button,
+ std::vector<application_manager::ApplicationSharedPtr>(uint32_t button));
+ MOCK_METHOD0(applications_with_navi,
+ std::vector<application_manager::ApplicationSharedPtr>());
+ MOCK_CONST_METHOD0(get_limited_media_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_navi_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_voice_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_METHOD1(application_id, uint32_t(const int32_t correlation_id));
+ MOCK_METHOD2(set_application_id,
+ void(const int32_t correlation_id, const uint32_t app_id));
+ MOCK_METHOD3(OnHMILevelChanged,
+ void(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to));
+ MOCK_METHOD1(
+ SendHMIStatusNotification,
+ void(const utils::SharedPtr<application_manager::Application> app));
+ MOCK_METHOD2(SendMessageToMobile,
+ void(application_manager::commands::MessageSharedPtr, bool));
+ MOCK_METHOD1(
+ SendMessageToHMI,
+ void(const application_manager::commands::MessageSharedPtr message));
+ MOCK_METHOD1(
+ ManageHMICommand,
+ bool(const application_manager::commands::MessageSharedPtr message));
+ MOCK_METHOD2(
+ ManageMobileCommand,
+ bool(const application_manager::commands::MessageSharedPtr message,
+ application_manager::commands::Command::CommandOrigin origin));
+ MOCK_CONST_METHOD1(
+ GetDefaultHmiLevel,
+ mobile_apis::HMILevel::eType(
+ application_manager::ApplicationConstSharedPtr application));
+ MOCK_METHOD0(hmi_capabilities, application_manager::HMICapabilities&());
+ MOCK_CONST_METHOD0(hmi_capabilities,
+ const application_manager::HMICapabilities&());
+ MOCK_METHOD2(ProcessQueryApp,
+ void(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key));
+ MOCK_CONST_METHOD0(is_attenuated_supported, bool());
+ MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited,
+ bool(application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(OnApplicationRegistered,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_CONST_METHOD0(connection_handler,
+ connection_handler::ConnectionHandler&());
+ MOCK_CONST_METHOD0(protocol_handler, protocol_handler::ProtocolHandler&());
+ MOCK_METHOD0(GetPolicyHandler, policy::PolicyHandlerInterface&());
+ MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
+ MOCK_METHOD0(GenerateNewHMIAppID, uint32_t());
+ MOCK_METHOD1(EndNaviServices, void(uint32_t app_id));
+ MOCK_METHOD0(BeginAudioPassThrough, bool());
+ MOCK_METHOD0(EndAudioPassThrough, bool());
+ MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
+ MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_CONST_METHOD0(IsHMICooperating, bool());
+ MOCK_METHOD2(IviInfoUpdated,
+ std::vector<application_manager::ApplicationSharedPtr>(
+ application_manager::VehicleDataType vehicle_info,
+ int value));
+ MOCK_METHOD1(RegisterApplication,
+ application_manager::ApplicationSharedPtr(const utils::SharedPtr<
+ smart_objects::SmartObject>& request_for_registration));
+ MOCK_METHOD0(SendUpdateAppList, void());
+ MOCK_METHOD2(MarkAppsGreyOut,
+ void(const connection_handler::DeviceHandle handle,
+ bool is_greyed_out));
+ MOCK_CONST_METHOD1(IsAppsQueriedFrom,
+ bool(const connection_handler::DeviceHandle handle));
+ MOCK_CONST_METHOD0(IsStopping, bool());
+ MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
+ void(const uint32_t app_id));
+ MOCK_METHOD4(
+ SaveBinary,
+ mobile_apis::Result::eType(const std::vector<uint8_t>& binary_data,
+ const std::string& file_path,
+ const std::string& file_name,
+ const int64_t offset));
+ MOCK_METHOD1(SetAllAppsAllowed, void(const bool allowed));
+ MOCK_METHOD1(set_driver_distraction, void(bool is_distracting));
+ MOCK_METHOD6(StartAudioPassThruThread,
+ void(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));
+ MOCK_METHOD0(StartDevicesDiscovery, void());
+ MOCK_METHOD1(StopAudioPassThru, void(int32_t application_key));
+ MOCK_METHOD2(TerminateRequest,
+ void(uint32_t connection_key, uint32_t corr_id));
+ MOCK_METHOD4(UnregisterApplication,
+ void(const uint32_t&, mobile_apis::Result::eType, bool, bool));
+ MOCK_METHOD3(updateRequestTimeout,
+ void(uint32_t connection_key,
+ uint32_t mobile_correlation_id,
+ uint32_t new_timeout_value));
+ MOCK_METHOD0(state_controller, application_manager::StateController&());
+ MOCK_METHOD1(SetUnregisterAllApplicationsReason,
+ void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_METHOD1(HeadUnitReset,
+ void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_CONST_METHOD2(HMILevelAllowsStreaming,
+ bool(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD5(CheckPolicyPermissions,
+ mobile_apis::Result::eType(
+ const std::string&,
+ mobile_apis::HMILevel::eType,
+ mobile_apis::FunctionID::eType,
+ const application_manager::RPCParams&,
+ application_manager::CommandParametersPermissions*));
+ MOCK_CONST_METHOD2(IsApplicationForbidden,
+ bool(uint32_t connection_key,
+ const std::string& policy_app_id));
+ MOCK_METHOD0(resume_controller, resumption::ResumeCtrl&());
+ MOCK_METHOD1(
+ GetDeviceTransportType,
+ hmi_apis::Common_TransportType::eType(const std::string& transport_type));
+ MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t app_id));
+ MOCK_METHOD0(GenerateGrammarID, uint32_t());
+ MOCK_CONST_METHOD1(GetUserConsentForDevice,
+ policy::DeviceConsent(const std::string& device_id));
+ MOCK_METHOD1(OnAppUnauthorized, void(const uint32_t& app_id));
+ MOCK_METHOD1(ActivateApplication,
+ bool(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD3(OnAppStreaming,
+ void(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state));
+ MOCK_CONST_METHOD4(CreateRegularState,
+ application_manager::HmiStatePtr(
+ uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context));
+ MOCK_METHOD2(SendAudioPassThroughNotification,
+ void(uint32_t session_key, std::vector<uint8_t>& binary_data));
+ MOCK_CONST_METHOD2(CanAppStream,
+ bool(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id));
+ MOCK_CONST_METHOD0(get_settings,
+ const application_manager::ApplicationManagerSettings&());
+ MOCK_METHOD0(event_dispatcher,
+ application_manager::event_engine::EventDispatcher&());
+
+ MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints, bool(const uint32_t));
+ MOCK_METHOD1(SubscribeAppForWayPoints, void(const uint32_t));
+ MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(const uint32_t));
+ MOCK_CONST_METHOD0(IsAnyAppSubscribedForWayPoints, bool());
+ MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<int32_t>());
+ MOCK_CONST_METHOD1(
+ WaitingApplicationByID,
+ application_manager::ApplicationConstSharedPtr(const uint32_t));
+ MOCK_CONST_METHOD0(
+ AppsWaitingForRegistration,
+ DataAccessor<application_manager::AppsWaitRegistrationSet>());
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
new file mode 100644
index 0000000000..916f4a69f0
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2016, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_EVENT_DISPATCHER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_EVENT_DISPATCHER_H_
+
+#include <list>
+#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/event_engine/event_observer.h"
+
+namespace test {
+namespace components {
+namespace event_engine_test {
+
+class MockEventDispatcher
+ : public ::application_manager::event_engine::EventDispatcher {
+ public:
+ MOCK_METHOD1(raise_event,
+ void(const ::application_manager::event_engine::Event& event));
+ MOCK_METHOD3(
+ add_observer,
+ void(const ::application_manager::event_engine::Event::EventID& event_id,
+ int32_t hmi_correlation_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD2(
+ remove_observer,
+ void(const ::application_manager::event_engine::Event::EventID& event_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD1(
+ remove_observer,
+ void(::application_manager::event_engine::EventObserver& observer));
+};
+
+} // namespace event_engine_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_EVENT_DISPATCHER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
new file mode 100644
index 0000000000..289b20a105
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -0,0 +1,174 @@
+/*
+ * 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"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/application_manager.h"
+
+namespace application_manager {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+class MockMessageHelper {
+ public:
+ MOCK_METHOD1(GetHashUpdateNotification,
+ smart_objects::SmartObjectSPtr(const uint32_t app_id));
+ MOCK_METHOD2(SendHashUpdateNotification,
+ void(const uint32_t app_id, ApplicationManager& app_mngr));
+ 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_METHOD2(SendNaviStartStream,
+ void(int32_t connection_key, ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendNaviStopStream,
+ void(int32_t connection_key, ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendOnAppPermissionsChangedNotification,
+ void(uint32_t connection_key,
+ const policy::AppPermissions& permissions,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendAudioStartStream,
+ void(int32_t connection_key, ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendAudioStopStream,
+ void(int32_t connection_key, ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendOnDataStreaming,
+ void(protocol_handler::ServiceType service,
+ bool available,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(CreateGetVehicleDataRequest,
+ void(uint32_t correlation_id,
+ const std::vector<std::string>& params,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendUpdateSDLResponse,
+ void(const std::string& result,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendGetUserFriendlyMessageResponse,
+ void(const std::vector<policy::UserFriendlyMessage>& msg,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendGetStatusUpdateResponse,
+ void(const std::string& status,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendOnStatusUpdate,
+ void(const std::string& status, ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendSDLActivateAppResponse,
+ void(policy::AppPermissions& permissions,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD1(SendGetSystemInfoRequest, void(ApplicationManager& app_mngr));
+
+ MOCK_METHOD4(SendPolicyUpdate,
+ void(const std::string& file_path,
+ int timeout,
+ const std::vector<int>& retries,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(
+ SendGetListOfPermissionsResponse,
+ void(const std::vector<policy::FunctionalGroupPermission>& permissions,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendOnPermissionsChangeNotification,
+ void(uint32_t connection_key,
+ const policy::Permissions& permissions,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD4(SendPolicySnapshotNotification,
+ void(uint32_t connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD1(CommonLanguageFromString,
+ hmi_apis::Common_Language::eType(const std::string& language));
+ MOCK_METHOD1(CommonLanguageToString,
+ std::string(hmi_apis::Common_Language::eType));
+ MOCK_METHOD2(CreateModuleInfoSO,
+ smart_objects::SmartObjectSPtr(uint32_t function_id,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendAllOnButtonSubscriptionNotificationsForApp,
+ void(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendOnResumeAudioSourceToHMI,
+ void(uint32_t app_id, ApplicationManager& app_mngr));
+ MOCK_METHOD2(CreateAddSubMenuRequestToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
+ const uint32_t correlation_id));
+ MOCK_METHOD2(CreateAddCommandRequestToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD1(CreateAddVRCommandRequestFromChoiceToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(GetIVISubscriptionRequests,
+ smart_objects::SmartObjectList(ApplicationSharedPtr app));
+ MOCK_METHOD3(VerifyImageFiles,
+ mobile_apis::Result::eType(smart_objects::SmartObject& message,
+
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD6(GetBCActivateAppRequestToHMI,
+ smart_objects::SmartObjectSPtr(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(GetOnAppInterfaceUnregisteredNotificationToMobile,
+ NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr(
+ int32_t connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+
+ 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/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
new file mode 100644
index 0000000000..09fe8d38b3
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2016, Ford Motor Company
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of the Ford Motor Company nor the names of its contributors
+* may be used to endorse or promote products derived from this software
+* without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*/
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_H_
+#include <string>
+#include "gmock/gmock.h"
+#include "application_manager/resumption/resumption_data.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_application_manager.h"
+
+namespace test {
+namespace components {
+namespace resumption_test {
+
+namespace app_mngr = application_manager;
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+
+class MockResumptionData : public ::resumption::ResumptionData {
+ public:
+ MockResumptionData(
+ const application_manager_test::MockApplicationManager& settings)
+ : ResumptionData(settings) {}
+ MOCK_METHOD1(SaveApplication,
+ void(app_mngr::ApplicationSharedPtr application));
+ MOCK_CONST_METHOD2(GetStoredHMILevel,
+ int32_t(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_CONST_METHOD1(IsHMIApplicationIdExist, bool(uint32_t hmi_app_id));
+ MOCK_CONST_METHOD2(GetHMIApplicationID,
+ uint32_t(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_METHOD0(OnSuspend, void());
+ MOCK_CONST_METHOD3(GetHashId,
+ bool(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id));
+ MOCK_METHOD0(OnAwake, void());
+ MOCK_CONST_METHOD3(GetSavedApplication,
+ bool(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app));
+ MOCK_METHOD2(RemoveApplicationFromSaved,
+ bool(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_CONST_METHOD0(GetIgnOffTime, uint32_t());
+ MOCK_CONST_METHOD2(IsApplicationSaved,
+ ssize_t(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_CONST_METHOD1(GetDataForLoadResumeData,
+ void(smart_objects::SmartObject& saved_data));
+ MOCK_METHOD3(UpdateHmiLevel,
+ void(const std::string& policy_app_id,
+ 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));
+ MOCK_METHOD0(Persist, void());
+};
+
+} // namespace resumption_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_H_
diff --git a/src/components/application_manager/test/state_controller/include/state_controller_mock.h b/src/components/application_manager/test/include/application_manager/mock_statistics_manager.h
index b9f7dd30dd..668959fe2e 100644
--- a/src/components/application_manager/test/state_controller/include/state_controller_mock.h
+++ b/src/components/application_manager/test/include/application_manager/mock_statistics_manager.h
@@ -1,5 +1,4 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
+/* Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,32 +28,38 @@
* 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_
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATE_CONTROLLER_MOCK
-#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATE_CONTROLLER_MOCK
+#include <string>
#include "gmock/gmock.h"
-#include "application_manager/application.h"
-#include "application_manager/hmi_state.h"
-#include "application_manager/state_controller.h"
-#include "application_manager/application_manager.h"
-#include "interfaces/MOBILE_API.h"
-namespace state_controller_test {
-namespace am = application_manager;
+#include "policy/usage_statistics/statistics_manager.h"
+#include "application_manager/usage_statistics.h"
-class StateControllerMock :public am::StateController {
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using namespace ::usage_statistics;
+class MockStatisticsManager : public StatisticsManager {
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_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() {}
};
-}
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATE_CONTROLLER_MOCK
+} // 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/include/application_manager/mock_telemetry_observer.h b/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h
new file mode 100644
index 0000000000..bc5d444eed
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h
@@ -0,0 +1,53 @@
+/*
+ * 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_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 application_manager_test {
+
+class MockAMTelemetryObserver
+ : public application_manager::AMTelemetryObserver {
+ public:
+ MOCK_METHOD1(OnMessage, void(MessageMetricSharedPtr));
+};
+
+} // 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/include/application_manager/policy_handler_interface_mock.h b/src/components/application_manager/test/include/application_manager/policy_handler_interface_mock.h
new file mode 100644
index 0000000000..51a0678b24
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/policy_handler_interface_mock.h
@@ -0,0 +1,203 @@
+/*
+ * 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 {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
+ public:
+ MOCK_METHOD0(LoadPolicyLibrary, bool());
+ MOCK_CONST_METHOD0(PolicyEnabled, bool());
+ MOCK_METHOD0(InitPolicyTable, bool());
+ MOCK_METHOD0(ResetPolicyTable, bool());
+ MOCK_METHOD0(ClearUserConsent, bool());
+ MOCK_METHOD2(SendMessageToSDK,
+ bool(const policy::BinaryMessage& pt_string,
+ const std::string& url));
+ MOCK_METHOD2(ReceiveMessageFromSDK,
+ bool(const std::string& file,
+ const policy::BinaryMessage& pt_string));
+ MOCK_METHOD0(UnloadPolicyLibrary, bool());
+ MOCK_METHOD3(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions,
+ const policy::HMILevel& default_hmi));
+ MOCK_METHOD2(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD3(OnSnapshotCreated,
+ void(const policy::BinaryMessage& pt_string,
+ const std::vector<int>& retry_delay_seconds,
+ int timeout_exchange));
+ MOCK_CONST_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id,
+ std::string* priority));
+ MOCK_METHOD5(CheckPermissions,
+ void(const policy::PTString& app_id,
+ const policy::PTString& hmi_level,
+ const policy::PTString& rpc,
+ const policy::RPCParams& rpc_params,
+ policy::CheckPermissionResult& result));
+ MOCK_CONST_METHOD1(GetNotificationsNumber,
+ uint32_t(const std::string& priority));
+ MOCK_CONST_METHOD1(GetUserConsentForDevice,
+ policy::DeviceConsent(const std::string& device_id));
+ MOCK_CONST_METHOD2(GetDefaultHmi,
+ bool(const std::string& policy_app_id,
+ std::string* default_hmi));
+
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string& application_id,
+ policy::StringArray* nicknames,
+ policy::StringArray* app_hmi_types));
+ MOCK_METHOD2(GetInitialAppData,
+ bool(const std::string& application_id,
+ policy::StringArray* nicknames));
+ MOCK_METHOD1(GetInitialAppData, bool(const std::string& application_id));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(int service_type, policy::EndpointUrls& end_points));
+ MOCK_METHOD0(ResetRetrySequence, void());
+ MOCK_METHOD0(NextRetryTimeout, uint32_t());
+ MOCK_METHOD0(TimeoutExchange, int());
+ MOCK_METHOD0(OnExceededTimeout, void());
+ MOCK_METHOD0(OnSystemReady, void());
+ MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
+ MOCK_METHOD1(add_listener, void(policy::PolicyHandlerObserver* listener));
+ MOCK_METHOD1(remove_listener, void(policy::PolicyHandlerObserver* listener));
+ MOCK_CONST_METHOD0(GetStatisticManager,
+ utils::SharedPtr<usage_statistics::StatisticsManager>());
+ MOCK_CONST_METHOD2(CheckSystemAction,
+ bool(mobile_apis::SystemAction::eType system_action,
+ const std::string& policy_app_id));
+ MOCK_METHOD1(KmsChanged, void(int kms));
+ MOCK_METHOD2(OnActivateApp,
+ void(uint32_t connection_key, uint32_t correlation_id));
+ MOCK_METHOD2(OnAllowSDLFunctionalityNotification,
+ void(bool is_allowed, const std::string& device_id));
+ MOCK_METHOD0(OnIgnitionCycleOver, void());
+ MOCK_METHOD1(OnPendingPermissionChange,
+ void(const std::string& policy_app_id));
+ MOCK_METHOD1(PTExchangeAtUserRequest, void(uint32_t correlation_id));
+ 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_METHOD2(OnAppPermissionConsent,
+ void(const uint32_t connection_key,
+ const policy::PermissionConsent& permissions));
+ MOCK_METHOD3(OnGetUserFriendlyMessage,
+ void(const std::vector<std::string>& message_codes,
+ const std::string& language,
+ uint32_t correlation_id));
+ MOCK_METHOD2(OnGetListOfPermissions,
+ void(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_METHOD1(OnGetStatusUpdate, void(const uint32_t correlation_id));
+ MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
+ MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
+ std::string(const std::string& policy_app_id));
+ MOCK_METHOD1(OnSystemInfoChanged, void(const std::string& language));
+ MOCK_METHOD3(OnGetSystemInfo,
+ void(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
+ MOCK_METHOD0(OnVIIsReady, void());
+ MOCK_METHOD1(OnVehicleDataUpdated,
+ void(const smart_objects::SmartObject& message));
+ MOCK_METHOD1(RemoveDevice, void(const std::string& device_id));
+ MOCK_METHOD1(AddStatisticsInfo, void(int type));
+ MOCK_METHOD1(OnSystemError, void(int code));
+ MOCK_CONST_METHOD0(GetAppIdForSending, uint32_t());
+ MOCK_METHOD1(
+ GetAppName,
+ utils::custom_string::CustomString(const std::string& policy_app_id));
+ MOCK_METHOD1(OnUpdateHMIAppType,
+ void(std::map<std::string, policy::StringArray> app_hmi_types));
+ MOCK_METHOD1(OnCertificateUpdated, void(const std::string& certificate_data));
+ MOCK_METHOD1(OnCertificateDecrypted, void(bool is_succeeded));
+ MOCK_METHOD0(CanUpdate, bool());
+ MOCK_METHOD2(OnDeviceConsentChanged,
+ void(const std::string& device_id, bool is_allowed));
+ MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
+ void(const policy::AppPermissions& permissions,
+ const std::string& policy_app_id));
+ MOCK_METHOD0(OnPTExchangeNeeded, void());
+ MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>& apps));
+ MOCK_METHOD1(AddApplication, void(const std::string& application_id));
+ MOCK_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD0(OnUpdateRequestSentToMobile, void());
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_METHOD0(OnAppsSearchStarted, void());
+ MOCK_METHOD0(OnAppsSearchCompleted, void());
+ MOCK_METHOD1(OnAppRegisteredOnMobile,
+ void(const std::string& application_id));
+ MOCK_CONST_METHOD2(IsRequestTypeAllowed,
+ bool(const std::string& policy_app_id,
+ mobile_apis::RequestType::eType type));
+ MOCK_CONST_METHOD1(
+ GetAppRequestTypes,
+ const std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ 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));
+ MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
+ MOCK_CONST_METHOD0(get_settings, const policy::PolicySettings&());
+
+ private:
+ MOCK_METHOD2(OnAppPermissionConsentInternal,
+ void(const uint32_t connection_key,
+ policy::PermissionConsent& permissions));
+};
+
+} // namespace policy
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_POLICY_HANDLER_INTERFACE_MOCK_H_
diff --git a/src/components/application_manager/test/resumption/include/resumption_data_mock.h b/src/components/application_manager/test/include/application_manager/resumption_data_mock.h
index 2c9285b025..6625b3e5b3 100644
--- a/src/components/application_manager/test/resumption/include/resumption_data_mock.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_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
@@ -35,6 +35,8 @@
#include "gmock/gmock.h"
#include "application_manager/resumption/resumption_data.h"
#include "application_manager/application.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_application_manager.h"
namespace test {
namespace components {
@@ -42,23 +44,25 @@ namespace resumption_test {
namespace app_mngr = application_manager;
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
-class ResumptionDataMock : public ::resumption::ResumptionData {
+class MockResumptionData : public ::resumption::ResumptionData {
public:
+ MockResumptionData(const application_manager_test::MockApplicationManager&
+ application_manager)
+ : ResumptionData(application_manager) {}
MOCK_METHOD1(SaveApplication,
void(app_mngr::ApplicationSharedPtr application));
MOCK_CONST_METHOD2(GetStoredHMILevel,
int32_t(const std::string& policy_app_id,
const std::string& device_id));
MOCK_CONST_METHOD1(IsHMIApplicationIdExist, bool(uint32_t hmi_app_id));
- MOCK_METHOD2(CheckSavedApplication, bool(const std::string& policy_app_id,
- const std::string& device_id));
MOCK_CONST_METHOD2(GetHMIApplicationID,
uint32_t(const std::string& policy_app_id,
const std::string& device_id));
MOCK_METHOD0(OnSuspend, void());
MOCK_CONST_METHOD3(GetHashId,
bool(const std::string& policy_app_id,
- const std::string& device_id, std::string& hash_id));
+ const std::string& device_id,
+ std::string& hash_id));
MOCK_METHOD0(OnAwake, void());
MOCK_CONST_METHOD3(GetSavedApplication,
bool(const std::string& policy_app_id,
@@ -73,10 +77,14 @@ class ResumptionDataMock : public ::resumption::ResumptionData {
const std::string& device_id));
MOCK_CONST_METHOD1(GetDataForLoadResumeData,
void(smart_objects::SmartObject& saved_data));
- MOCK_METHOD3(UpdateHmiLevel, void(const std::string& policy_app_id,
- const std::string& device_id,
- mobile_apis::HMILevel::eType hmi_level));
+ MOCK_METHOD3(UpdateHmiLevel,
+ void(const std::string& policy_app_id,
+ 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));
+ MOCK_METHOD0(Persist, void());
};
} // namespace resumption_test
diff --git a/src/components/application_manager/test/resumption/include/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index 55767225b5..b648b8ab82 100644
--- a/src/components/application_manager/test/resumption/include/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.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
@@ -30,13 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_RESUMPTION_DATA_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_RESUMPTION_DATA_TEST_H_
+
#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 "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "utils/data_accessor.h"
+#include "config_profile/profile.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/mock_application_manager_settings.h"
namespace test {
namespace components {
@@ -52,13 +61,22 @@ using namespace mobile_apis;
class ResumptionDataTest : public ::testing::Test {
protected:
+ ResumptionDataTest()
+ : kCountOfCommands_(5u)
+ , kCountOfChoice_(2u)
+ , kCountOfChoiceSets_(4u)
+ , kCountOfSubmenues_(3u)
+ , kCountOfFiles_(8u)
+ , kCountOfVrhelptitle_(2u)
+ , kMacAddress_("12345") {}
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
-
// Set data for resumption
virtual void PrepareData();
- utils::SharedPtr<NiceMock<ApplicationMock>> app_mock;
+ utils::SharedPtr<NiceMock<application_manager_test::MockApplication>>
+ app_mock;
+ profile::Profile profile_;
HMILevel::eType hmi_level_;
size_t app_id_;
size_t hmi_app_id_;
@@ -105,13 +123,13 @@ class ResumptionDataTest : public ::testing::Test {
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 device_id_ = "12345";
+ const size_t kCountOfCommands_;
+ const size_t kCountOfChoice_;
+ const size_t kCountOfChoiceSets_;
+ const size_t kCountOfSubmenues_;
+ const size_t kCountOfFiles_;
+ const size_t kCountOfVrhelptitle_;
+ const std::string kMacAddress_;
am::CommandsMap test_commands_map;
am::SubMenuMap test_submenu_map;
@@ -126,8 +144,13 @@ class ResumptionDataTest : public ::testing::Test {
sync_primitives::Lock setlock_;
sync_primitives::Lock btnlock_;
sync_primitives::Lock ivilock_;
+ application_manager_test::MockApplicationManagerSettings
+ mock_application_manager_settings_;
+ application_manager_test::MockApplicationManager mock_application_manager_;
};
} // namespace resumption_test
} // namespace components
} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_RESUMPTION_DATA_TEST_H_
diff --git a/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h b/src/components/application_manager/test/include/application_manager/statistics_manager_mock.h
index 4e2dae78d1..cff4194118 100644
--- a/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h
+++ b/src/components/application_manager/test/include/application_manager/statistics_manager_mock.h
@@ -35,18 +35,25 @@
#include <string>
#include "gmock/gmock.h"
-#include "usage_statistics/statistics_manager.h"
+#include "policy/usage_statistics/statistics_manager.h"
+namespace test {
+namespace components {
namespace state_controller_test {
+
namespace us = usage_statistics;
-class StatisticsManagerMock : public us::StatisticsManager {
+class MockStatisticsManager : public us::StatisticsManager {
public:
- MOCK_METHOD1(Increment, void (us::GlobalCounterId));
- MOCK_METHOD2(Increment, void (const std::string&, us::AppCounterId));
- MOCK_METHOD3(Set, void (const std::string&, us::AppInfoId, const std::string&));
- MOCK_METHOD3(Add, void (const std::string&, us::AppStopwatchId, int32_t));
+ MOCK_METHOD1(Increment, void(us::GlobalCounterId));
+ MOCK_METHOD2(Increment, void(const std::string&, us::AppCounterId));
+ MOCK_METHOD3(Set,
+ void(const std::string&, us::AppInfoId, const std::string&));
+ MOCK_METHOD3(Add, void(const std::string&, us::AppStopwatchId, int32_t));
};
} // 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/include/application_manager/test_resumption_data_db.h b/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h
new file mode 100644
index 0000000000..e10f60afac
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_TEST_RESUMPTION_DATA_DB_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_TEST_RESUMPTION_DATA_DB_H_
+
+#include "utils/sqlite_wrapper/sql_database.h"
+#include "application_manager/resumption/resumption_data_db.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_application_manager.h"
+
+using ::resumption::ResumptionDataDB;
+
+namespace test {
+namespace components {
+namespace resumption_test {
+
+class TestResumptionDataDB : public ResumptionDataDB {
+ public:
+ utils::dbms::SQLDatabase* get_db_handle() {
+ return db();
+ }
+
+ application_manager_test::MockApplicationManager mock_application_manager_;
+ TestResumptionDataDB(DbStorage db_storage)
+ : ResumptionDataDB(db_storage, mock_application_manager_) {}
+};
+
+} // namespace resumption_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_TEST_RESUMPTION_DATA_DB_H_
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..bfc0228bbb
--- /dev/null
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt
@@ -0,0 +1,61 @@
+# 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
+ MessageHelper
+ 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 100644
index 0000000000..77e791dc82
--- /dev/null
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -0,0 +1,906 @@
+/*
+ * 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"
+#include "policy/mock_policy_settings.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/resumption/resume_ctrl.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<MockApplication>();
+ 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, 0u);
+
+ 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, 0u);
+
+ 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, 0u);
+
+ 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<MockApplication>();
+ ::application_manager::CommandsMap vis;
+ DataAccessor<application_manager::CommandsMap> data_accessor(vis, true);
+
+ EXPECT_CALL(*appSharedMock, commands_map()).WillOnce(Return(data_accessor));
+ application_manager_test::MockApplicationManager mock_application_manager;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddCommandRequestToHMI(appSharedMock,
+ mock_application_manager);
+
+ 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));
+ application_manager_test::MockApplicationManager mock_application_manager;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddCommandRequestToHMI(appSharedMock,
+ mock_application_manager);
+
+ 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));
+ application_manager_test::MockApplicationManager mock_application_manager;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ appSharedMock, mock_application_manager);
+
+ 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));
+ application_manager_test::MockApplicationManager mock_application_manager;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ appSharedMock, mock_application_manager);
+
+ 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));
+
+ const uint32_t cor_id = 0u;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock, cor_id);
+
+ 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));
+
+ const uint32_t cor_id = 0u;
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock, cor_id);
+
+ 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:
+ application_manager_test::MockApplicationManager mock_application_manager;
+ 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,
+ mock_application_manager);
+ // 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;
+ policy_handler_test::MockPolicySettings policy_settings_;
+ const policy::PolicyHandler policy_handler(policy_settings_,
+ mock_application_manager);
+ // Method call
+ mobile_apis::Result::eType result = MessageHelper::ProcessSoftButtons(
+ object, appSharedMock, policy_handler, mock_application_manager);
+ // 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";
+ policy_handler_test::MockPolicySettings policy_settings_;
+ const policy::PolicyHandler policy_handler(policy_settings_,
+ mock_application_manager);
+ // Method call
+ mobile_apis::Result::eType result = MessageHelper::ProcessSoftButtons(
+ object, appSharedMock, policy_handler, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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, mock_application_manager);
+ // 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..34a817d096 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,226 @@
* 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 +257,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..8301bf6f18
--- /dev/null
+++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
@@ -0,0 +1,126 @@
+/*
+ * 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/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
deleted file mode 100644
index bc6a4e6ba4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
+++ /dev/null
@@ -1,373 +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_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#include <stdint.h>
-#include <vector>
-#include <map>
-#include <set>
-#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/vehicle_info_data.h"
-#include "application_manager/state_controller.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 "media_manager/media_manager_impl.h"
-
-#include "connection_handler/connection_handler_observer.h"
-#include "connection_handler/device.h"
-
-#include "formatters/CSmartFactory.hpp"
-
-#include "interfaces/HMI_API.h"
-#include "interfaces/HMI_API_schema.h"
-#include "interfaces/MOBILE_API_schema.h"
-
-#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
-
-#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-#include "utils/message_queue.h"
-#include "utils/prioritized_queue.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/message_loop_thread.h"
-#include "utils/lock.h"
-#include "utils/singleton.h"
-
-namespace application_manager {
- enum VRTTSSessionChanging {
- kVRSessionChanging = 0,
- kTTSSessionChanging
- };
-
-namespace impl {
-
-struct MessageFromMobile: public utils::SharedPtr<Message> {
- explicit MessageFromMobile(const 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> {
- explicit MessageToMobile(const utils::SharedPtr<Message>& message,
- bool 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();
- }
- // Signals if connection to mobile must be closed after sending this message
- bool is_final;
-};
-
-struct MessageFromHmi: public utils::SharedPtr<Message> {
- explicit MessageFromHmi(const 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> {
- explicit MessageToHmi(const 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;
-
-// AudioPassThru
-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::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;
-
- public:
- ApplicationManagerImpl() {
- std::cout << "ApplicationManagerImpl Mock created " << std::endl;
- }
-
- 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*));
-#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&));
- MOCK_METHOD1(RemoveAppDataFromHMI, bool(ApplicationSharedPtr));
- MOCK_METHOD1(HeadUnitReset, void(mobile_api::AppInterfaceUnregisteredReason::eType));
- 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_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_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(end_audio_pass_thru, uint32_t());
- MOCK_METHOD1(StopAudioPassThru, void(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_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_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_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(removeNotification, void(const commands::Command*));
- MOCK_METHOD1(addNotification, void(const CommandSharedPtr ));
- MOCK_METHOD0(StartDevicesDiscovery, void());
- 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));
-
- template<bool SendActivateApp>
- MOCK_METHOD2(SetState, void(uint32_t, HmiState));
- 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));
-
- MOCK_CONST_METHOD0(all_apps_allowed, bool());
- MOCK_METHOD1(set_vr_session_started, void(const bool));
- MOCK_CONST_METHOD0(vr_session_started, bool());
- MOCK_METHOD1(set_driver_distraction, void(const bool));
- 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(OnTimerSendTTSGlobalProperties, void());
- MOCK_METHOD0(CreatePhoneCallAppList, void());
- MOCK_METHOD0(ResetPhoneCallAppList, void());
- 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_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_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();
- }
- };
-
- // 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> {
- public:
- ApplicationListUpdateTimer(ApplicationManagerImpl* callee) :
- timer::TimerThread<ApplicationManagerImpl>("AM ListUpdater",
- callee, &ApplicationManagerImpl::OnApplicationListUpdateTimer
- ) {
- }
- };
- typedef utils::SharedPtr<ApplicationListUpdateTimer> ApplicationListUpdateTimerSptr;
-
-
- private:
- //FIXME(AKutsan) In resume_controller is is nessesery to change realisation for remove using application_list_
- ApplictionSet application_list_;
- FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl);
-};
-
-} //application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_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_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/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/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
new file mode 100644
index 0000000000..c53927d3a4
--- /dev/null
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -0,0 +1,309 @@
+/*
+ * 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 "application_manager/mock_message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace application_manager {
+
+void MessageHelper::SendHashUpdateNotification(uint32_t const app_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendHashUpdateNotification(
+ app_id, app_mngr);
+}
+void MessageHelper::SendNaviStartStream(int32_t connection_key,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendNaviStartStream(connection_key,
+ app_mngr);
+}
+void MessageHelper::SendNaviStopStream(int32_t connection_key,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendNaviStopStream(connection_key,
+ app_mngr);
+}
+void MessageHelper::SendAudioStartStream(int32_t connection_key,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendAudioStartStream(connection_key,
+ app_mngr);
+}
+void MessageHelper::SendAudioStopStream(int32_t connection_key,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendAudioStopStream(connection_key,
+ app_mngr);
+}
+void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
+ bool available,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendOnDataStreaming(
+ service, available, app_mngr);
+}
+
+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,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()
+ ->SendOnAppPermissionsChangedNotification(
+ connection_key, permissions, app_mngr);
+}
+
+void MessageHelper::SendGetUserFriendlyMessageResponse(
+ const std::vector<policy::UserFriendlyMessage>& msg,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendGetUserFriendlyMessageResponse(
+ msg, correlation_id, app_mngr);
+}
+
+void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendGetStatusUpdateResponse(
+ status, correlation_id, app_mngr);
+}
+
+void MessageHelper::SendOnStatusUpdate(const std::string& status,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendOnStatusUpdate(status,
+ app_mngr);
+}
+
+void MessageHelper::SendGetSystemInfoRequest(ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendGetSystemInfoRequest(app_mngr);
+}
+
+void MessageHelper::CreateGetVehicleDataRequest(
+ uint32_t correlation_id,
+ const std::vector<std::string>& params,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->CreateGetVehicleDataRequest(
+ correlation_id, params, app_mngr);
+}
+
+void MessageHelper::SendGetListOfPermissionsResponse(
+ const std::vector<policy::FunctionalGroupPermission>& permissions,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendGetListOfPermissionsResponse(
+ permissions, correlation_id, app_mngr);
+}
+
+void MessageHelper::SendOnPermissionsChangeNotification(
+ uint32_t connection_key,
+ const policy::Permissions& permissions,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendOnPermissionsChangeNotification(
+ connection_key, permissions, app_mngr);
+}
+
+void MessageHelper::SendPolicySnapshotNotification(
+ uint32_t connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendPolicySnapshotNotification(
+ connection_key, policy_data, url, app_mngr);
+}
+
+void MessageHelper::SendSDLActivateAppResponse(
+ policy::AppPermissions& permissions,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendSDLActivateAppResponse(
+ permissions, correlation_id, app_mngr);
+}
+
+void MessageHelper::SendPolicyUpdate(const std::string& file_path,
+ int timeout,
+ const std::vector<int>& retries,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendPolicyUpdate(
+ file_path, timeout, retries, app_mngr);
+}
+
+void MessageHelper::SendUpdateSDLResponse(const std::string& result,
+ uint32_t correlation_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendUpdateSDLResponse(
+ result, correlation_id, app_mngr);
+}
+
+hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
+ const std::string& language) {
+ return MockMessageHelper::message_helper_mock()->CommonLanguageFromString(
+ language);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
+ uint32_t function_id, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->CreateModuleInfoSO(
+ function_id, app_mngr);
+}
+
+MockMessageHelper* MockMessageHelper::message_helper_mock() {
+ static MockMessageHelper message_helper_mock;
+ return &message_helper_mock;
+}
+void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()
+ ->SendAllOnButtonSubscriptionNotificationsForApp(app, app_mngr);
+}
+
+void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendOnResumeAudioSourceToHMI(
+ app_id, app_mngr);
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
+ ApplicationConstSharedPtr app, const uint32_t correlation_id) {
+ return MockMessageHelper::message_helper_mock()->CreateAddSubMenuRequestToHMI(
+ app, correlation_id);
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->CreateAddCommandRequestToHMI(
+ app, app_mngr);
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateAddVRCommandRequestFromChoiceToHMI(app);
+}
+
+void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->SendGlobalPropertiesToHMI(
+ app);
+}
+
+smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
+ ApplicationSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->GetIVISubscriptionRequests(
+ app);
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->VerifyImageFiles(
+ message, app, app_mngr);
+}
+std::string MessageHelper::CommonLanguageToString(
+ hmi_apis::Common_Language::eType lang) {
+ return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->GetBCActivateAppRequestToHMI(
+ app,
+ session_observer,
+ policy_handler,
+ level,
+ send_policy_priority,
+ app_mngr);
+}
+
+NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr
+MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ int32_t connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::eType reason) {
+ return MockMessageHelper::message_helper_mock()
+ ->GetOnAppInterfaceUnregisteredNotificationToMobile(connection_key,
+ reason);
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc
new file mode 100644
index 0000000000..25b54453e5
--- /dev/null
+++ b/src/components/application_manager/test/policy_event_observer_test.cc
@@ -0,0 +1,140 @@
+/*
+ * 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/policies/policy_event_observer.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+
+#include "gmock/gmock.h"
+#include "policy/policy_types.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/mock_event_dispatcher.h"
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+using application_manager::event_engine::Event;
+using namespace policy;
+
+using testing::_;
+using ::testing::Return;
+
+class PolicyEventObserverTest : public ::testing::Test {
+ public:
+ PolicyEventObserverTest()
+ : policy_event_observer_(NULL), event_(NULL), field_name("odometer") {}
+
+ protected:
+ MockPolicyHandlerInterface policy_handler_mock_;
+ event_engine_test::MockEventDispatcher mock_event_dispatcher_;
+ PolicyEventObserver* policy_event_observer_;
+ Event* event_;
+ smart_objects::SmartObject smart_object_;
+ const std::string field_name;
+ const int field_value = 100;
+
+ virtual void SetUp() OVERRIDE {
+ policy_event_observer_ =
+ new PolicyEventObserver(&policy_handler_mock_, mock_event_dispatcher_);
+ }
+
+ void TearDown() OVERRIDE {
+ delete policy_event_observer_;
+ DeleteEvent();
+ }
+
+ void CreateEvent(const Event::EventID& event_id) {
+ event_ = new Event(event_id);
+ }
+
+ void CookSmartObject(const hmi_apis::Common_Result::eType& result,
+ const std::string& msg_params_field,
+ int msg_params_field_value) {
+ smart_object_["params"]["code"] = result;
+ smart_object_["msg_params"][msg_params_field] = msg_params_field_value;
+ }
+
+ void CheckResultsOnEvent(uint32_t pt_updated_calls_number,
+ uint32_t on_system_ready_calls_number) {
+ event_->set_smart_object(smart_object_);
+ EXPECT_CALL(policy_handler_mock_,
+ PTUpdatedAt(Counters::KILOMETERS, field_value))
+ .Times(pt_updated_calls_number);
+ EXPECT_CALL(policy_handler_mock_, OnSystemReady())
+ .Times(on_system_ready_calls_number);
+ policy_event_observer_->on_event(*event_);
+ }
+
+ void DeleteEvent() {
+ delete event_;
+ }
+};
+
+TEST_F(PolicyEventObserverTest, OnEvent_EventInvalid_ExpectNoProcessingEvent) {
+ // Arrange
+ CreateEvent(Event::EventID::INVALID_ENUM);
+ CookSmartObject(hmi_apis::Common_Result::SUCCESS, field_name, field_value);
+ CheckResultsOnEvent(0u, 0u);
+}
+
+TEST_F(PolicyEventObserverTest,
+ OnEvent_EventInvalidCommonResult_ExpectNoProcessingEvent) {
+ // Arrange
+ CreateEvent(Event::EventID::VehicleInfo_GetVehicleData);
+ CookSmartObject(
+ hmi_apis::Common_Result::INVALID_DATA, field_name, field_value);
+ // Check
+ CheckResultsOnEvent(0u, 0u);
+}
+
+TEST_F(PolicyEventObserverTest,
+ OnEvent_EventGetVehicleData_ExpectProcessOdometerEvent) {
+ // Arrange
+ CreateEvent(Event::EventID::VehicleInfo_GetVehicleData);
+ CookSmartObject(hmi_apis::Common_Result::SUCCESS, field_name, field_value);
+ // Check
+ CheckResultsOnEvent(1u, 0u);
+}
+
+TEST_F(PolicyEventObserverTest,
+ OnEvent_EventBasicCommunication_OnReady_ExpectOnSystemReady) {
+ // Arrange
+ CreateEvent(Event::EventID::BasicCommunication_OnReady);
+ CookSmartObject(hmi_apis::Common_Result::SUCCESS, field_name, field_value);
+ // Check
+ CheckResultsOnEvent(0u, 1u);
+}
+
+} // namespace policy_event_observer
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
new file mode 100644
index 0000000000..44b4791f85
--- /dev/null
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -0,0 +1,1478 @@
+/*
+ * 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 <string>
+#include <vector>
+#include <fstream>
+#include "gmock/gmock.h"
+
+#include "application_manager/policies/policy_handler.h"
+#include "policy/mock_policy_manager.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_impl.h"
+#include "security_manager/mock_security_manager.h"
+#include "security_manager/mock_crypto_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "transport_manager/mock_transport_manager.h"
+#include "policy/policy_types.h"
+#include "json/reader.h"
+#include "json/writer.h"
+#include "json/value.h"
+#include "smart_objects/smart_object.h"
+#include "utils/file_system.h"
+#include "utils/make_shared.h"
+#include "utils/custom_string.h"
+#include "policy/usage_statistics/counter.h"
+#include "policy/usage_statistics/statistics_manager.h"
+#include "interfaces/MOBILE_API.h"
+#include "policy/mock_policy_settings.h"
+#include "application_manager/mock_application.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/policies/mock_policy_handler_observer.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_state_controller.h"
+
+namespace test {
+namespace components {
+namespace policy_handler_test {
+
+using namespace application_manager;
+using namespace policy;
+using namespace utils::custom_string;
+using testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::NiceMock;
+using ::testing::SetArgReferee;
+using ::testing::SetArgPointee;
+using ::testing::DoAll;
+using ::testing::SetArgReferee;
+
+class PolicyHandlerTest : public ::testing::Test {
+ public:
+ PolicyHandlerTest()
+ : policy_handler_(policy_settings_, app_manager_)
+ , kPolicyAppId_("fake_app_id")
+ , kMacAddr_("kMacAddr_ess")
+ , kDeviceId_("fake_device_id")
+ , kHmiLevel_("NONE")
+ , kRpc_("fake_rpc")
+ , priority_("fake_priority")
+ , default_hmi_("fake_hmi")
+ , kPreloadPTFile_("sdl_preloaded_pt.json")
+ , kAppStorageFolder_("storage")
+ , app_set(test_app, app_lock)
+ , kAppId_(10u)
+ , kSnapshotFile_("snapshot")
+ , kSnapshotStorage_("snapshot_storage") {}
+
+ protected:
+ NiceMock<MockPolicySettings> policy_settings_;
+ NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
+ utils::SharedPtr<application_manager_test::MockApplication> mock_app_;
+ connection_handler_test::MockConnectionHandler conn_handler;
+ protocol_handler_test::MockSessionObserver mock_session_observer;
+ application_manager_test::MockStateController mock_state_controller;
+ PolicyHandler policy_handler_;
+ utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_;
+ application_manager_test::MockApplicationManager app_manager_;
+ const std::string kPolicyAppId_;
+ const std::string kMacAddr_;
+ const std::string kDeviceId_;
+ const std::string kHmiLevel_;
+ const std::string kRpc_;
+ std::string priority_;
+ std::string default_hmi_;
+ const std::string kPreloadPTFile_;
+ const std::string kAppStorageFolder_;
+ ApplicationSet test_app;
+ sync_primitives::Lock app_lock;
+ DataAccessor<ApplicationSet> app_set;
+ const uint32_t kAppId_;
+ const std::string kSnapshotFile_;
+ const std::string kSnapshotStorage_;
+
+ virtual void SetUp() OVERRIDE {
+ ON_CALL(app_manager_, applications()).WillByDefault(Return(app_set));
+ ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true));
+ ON_CALL(app_manager_, event_dispatcher())
+ .WillByDefault(ReturnRef(mock_event_dispatcher_));
+ std::string path = file_system::CreateDirectory("storage");
+ file_system::CreateFile(path + "/" + "certificate");
+ mock_policy_manager_ =
+ utils::MakeShared<policy_manager_test::MockPolicyManager>();
+ ASSERT_TRUE(mock_policy_manager_.valid());
+
+ ON_CALL(app_manager_, connection_handler())
+ .WillByDefault(ReturnRef(conn_handler));
+ ON_CALL(conn_handler, get_session_observer())
+ .WillByDefault(ReturnRef(mock_session_observer));
+
+ mock_app_ = utils::MakeShared<application_manager_test::MockApplication>();
+ }
+
+ virtual void TearDown() OVERRIDE {
+ ON_CALL(mock_event_dispatcher_, remove_observer(_, _));
+ }
+
+ void ChangePolicyManagerToMock() {
+ policy_handler_.SetPolicyManager(mock_policy_manager_);
+ }
+
+ void EnablePolicy() {
+ ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true));
+ ON_CALL(policy_settings_, preloaded_pt_file())
+ .WillByDefault(ReturnRef(kPreloadPTFile_));
+ ON_CALL(policy_settings_, app_storage_folder())
+ .WillByDefault(ReturnRef(kAppStorageFolder_));
+ }
+
+ void EnablePolicyAndPolicyManagerMock() {
+ EnablePolicy();
+ ChangePolicyManagerToMock();
+ }
+
+ void TestActivateApp(const uint32_t connection_key,
+ const uint32_t correlation_id);
+ void GetAppIDForSending();
+ void OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType hmi_level);
+
+ void ExtendedPolicyExpectations() {
+ const std::vector<int> retry_sequence_delay_seconds;
+
+ EXPECT_CALL(policy_settings_, policies_snapshot_file_name())
+ .WillOnce(ReturnRef(kSnapshotFile_));
+ EXPECT_CALL(policy_settings_, system_files_path())
+ .WillOnce(ReturnRef(kSnapshotStorage_));
+ EXPECT_CALL(*mock_policy_manager_, TimeoutExchange()).WillOnce(Return(1));
+ EXPECT_CALL(*mock_policy_manager_, RetrySequenceDelaysSeconds())
+ .WillOnce(Return(retry_sequence_delay_seconds));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendPolicyUpdate(_, _, _, _));
+ }
+};
+
+TEST_F(PolicyHandlerTest, LoadPolicyLibrary_Method_ExpectLibraryLoaded) {
+ // Check before policy enabled from ini file
+ EXPECT_CALL(policy_settings_, enable_policy()).WillRepeatedly(Return(false));
+ EXPECT_FALSE(policy_handler_.LoadPolicyLibrary());
+ EXPECT_CALL(policy_settings_, enable_policy()).WillRepeatedly(Return(true));
+ // Check
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+
+ EXPECT_TRUE(policy_handler_.UnloadPolicyLibrary());
+}
+
+TEST_F(PolicyHandlerTest,
+ InitPolicyTable_WithoutPreloadedFile_ExpectPolicyTableNotInitialized) {
+ // Check
+ EXPECT_FALSE(policy_handler_.InitPolicyTable());
+}
+
+TEST_F(PolicyHandlerTest,
+ InitPolicyTable_WithPreloadedFile_ExpectPolicyTableInitialized) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ // Check
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ EXPECT_TRUE(policy_handler_.UnloadPolicyLibrary());
+}
+
+TEST_F(PolicyHandlerTest,
+ ResetPolicyTable_WithoutPreloadedFile_ExpectPolicyTableNotReset) {
+ // Check
+ EXPECT_FALSE(policy_handler_.ResetPolicyTable());
+}
+
+TEST_F(PolicyHandlerTest, ResetPolicyTable_PTNotInitialised_PTNotReset) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ // Check
+ EXPECT_TRUE(policy_handler_.ResetPolicyTable());
+}
+
+TEST_F(PolicyHandlerTest,
+ ResetPolicyTable_WithPreloadedFile_ExpectPolicyTableReset) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ // Check
+ EXPECT_TRUE(policy_handler_.ResetPolicyTable());
+}
+
+TEST_F(PolicyHandlerTest, ResetPolicyTable_ExpectCallPMResetPT) {
+ ChangePolicyManagerToMock();
+ EnablePolicy();
+ EXPECT_CALL(*mock_policy_manager_, ResetPT(_));
+ policy_handler_.ResetPolicyTable();
+}
+
+TEST_F(PolicyHandlerTest, ClearUserConsent) {
+ EnablePolicyAndPolicyManagerMock();
+ EXPECT_CALL(*mock_policy_manager_, ResetUserConsent());
+ policy_handler_.ClearUserConsent();
+}
+
+TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ // Check
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ ChangePolicyManagerToMock();
+ std::string file_name("sdl_pt_update.json");
+ std::ifstream ifile(file_name);
+ Json::Reader reader;
+ std::string json;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ json = root.toStyledString();
+ }
+ ifile.close();
+ BinaryMessage msg(json.begin(), json.end());
+ // Checks
+ EXPECT_CALL(app_manager_, GetNextHMICorrelationID());
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ CreateGetVehicleDataRequest(_, _, _));
+ EXPECT_CALL(*mock_policy_manager_, PTUpdatedAt(_, _));
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg)).WillOnce(Return(true));
+ EXPECT_CALL(*mock_policy_manager_, CleanupUnpairedDevices());
+ policy_handler_.ReceiveMessageFromSDK("", msg);
+}
+
+TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK_PTNotLoaded) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ BinaryMessage msg;
+ // Checks
+
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg)).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, ForcePTExchange()).WillOnce(Return(""));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnStatusUpdate(_, _));
+ EXPECT_CALL(app_manager_, GetNextHMICorrelationID()).Times(0);
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ CreateGetVehicleDataRequest(_, _, _)).Times(0);
+ policy_handler_.ReceiveMessageFromSDK("", msg);
+}
+
+TEST_F(PolicyHandlerTest, UnloadPolicyLibrary_method_ExpectLibraryUnloaded) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ ChangePolicyManagerToMock();
+ // Act
+ EXPECT_TRUE(policy_handler_.UnloadPolicyLibrary());
+ // Check
+ EXPECT_FALSE(policy_handler_.InitPolicyTable());
+}
+
+TEST_F(PolicyHandlerTest, OnPermissionsUpdated_method_With2Parameters) {
+ // Check expectations
+ EXPECT_CALL(app_manager_, application_by_policy_id(_))
+ .WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnPermissionsChangeNotification(kAppId_, _, _));
+ // Act
+ Permissions perms;
+ policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPermissionsUpdated_MethodWith3Parameters_FromNONE_ToFULL) {
+ // Set hmi level from NONE to FULL
+ const std::string new_kHmiLevel_string = "HMI_FULL";
+ mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
+ // Check expectations
+ EXPECT_CALL(app_manager_, application_by_policy_id(_))
+ .Times(2)
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ StringToHMILevel(new_kHmiLevel_string))
+ .WillOnce(Return(new_hmi_level));
+
+ EXPECT_CALL(*mock_app_, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnPermissionsChangeNotification(kAppId_, _, _));
+
+ EXPECT_CALL(app_manager_, state_controller())
+ .WillRepeatedly(ReturnRef(mock_state_controller));
+ EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true));
+ // Act
+ Permissions perms;
+ policy_handler_.OnPermissionsUpdated(
+ kPolicyAppId_, perms, new_kHmiLevel_string);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPermissionsUpdated_MethodWith3Parameters_FromNONE_ToNotFull) {
+ // Set hmi level from NONE to Limited
+ const std::string new_kHmiLevel_string = "HMI_LIMITED";
+ mobile_apis::HMILevel::eType new_hmi_level =
+ mobile_apis::HMILevel::HMI_LIMITED;
+ // Check expectations
+ EXPECT_CALL(app_manager_, application_by_policy_id(_))
+ .Times(2)
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ StringToHMILevel(new_kHmiLevel_string))
+ .WillOnce(Return(new_hmi_level));
+
+ EXPECT_CALL(*mock_app_, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnPermissionsChangeNotification(kAppId_, _, _));
+
+ EXPECT_CALL(app_manager_, state_controller())
+ .WillRepeatedly(ReturnRef(mock_state_controller));
+ EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false));
+ // Act
+ Permissions perms;
+ policy_handler_.OnPermissionsUpdated(
+ kPolicyAppId_, perms, new_kHmiLevel_string);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPermissionsUpdated_MethodWith3Parameters_FromNotNONE) {
+ // Set hmi level from LIMITED to FULL
+ std::string new_kHmiLevel_string = "HMI_FULL";
+ mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
+ // Check expectations
+ EXPECT_CALL(app_manager_, application_by_policy_id(_))
+ .Times(2)
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ StringToHMILevel(new_kHmiLevel_string))
+ .WillOnce(Return(new_hmi_level));
+
+ EXPECT_CALL(*mock_app_, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnPermissionsChangeNotification(kAppId_, _, _));
+
+ EXPECT_CALL(app_manager_, state_controller()).Times(0);
+ // Act
+ Permissions perms;
+ policy_handler_.OnPermissionsUpdated(
+ kPolicyAppId_, perms, new_kHmiLevel_string);
+}
+
+TEST_F(PolicyHandlerTest, GetPriority) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetPriority(kPolicyAppId_, &priority_));
+ // Act
+ policy_handler_.GetPriority(kPolicyAppId_, &priority_);
+}
+
+TEST_F(PolicyHandlerTest, CheckPermissions) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ CheckPermissionResult result;
+ RPCParams kRpc_params;
+ // Check expectations
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ CheckPermissions(kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _));
+ // Act
+ policy_handler_.CheckPermissions(
+ kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, result);
+}
+
+TEST_F(PolicyHandlerTest, GetNotificationsNumber) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetNotificationsNumber(priority_));
+ // Act
+ policy_handler_.GetNotificationsNumber(priority_);
+}
+
+TEST_F(PolicyHandlerTest, GetUserConsentForDevice) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kDeviceId_))
+ .WillOnce(Return(DeviceConsent::kDeviceHasNoConsent));
+ // Act
+ policy_handler_.GetUserConsentForDevice(kDeviceId_);
+}
+
+TEST_F(PolicyHandlerTest, GetDefaultHmi) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_,
+ GetDefaultHmi(kPolicyAppId_, &default_hmi_));
+ // Act
+ policy_handler_.GetDefaultHmi(kPolicyAppId_, &default_hmi_);
+}
+
+TEST_F(PolicyHandlerTest, GetInitialAppData) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ StringArray* nicknames = NULL;
+ StringArray* app_hmi_types = NULL;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_,
+ GetInitialAppData(kPolicyAppId_, nicknames, app_hmi_types));
+ // Act
+ policy_handler_.GetInitialAppData(kPolicyAppId_, nicknames, app_hmi_types);
+}
+
+TEST_F(PolicyHandlerTest, GetServiceUrls) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ EndpointUrls endpoints;
+ const std::string service_type_ = "0x0";
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetServiceUrls(service_type_, _));
+ // Act
+ policy_handler_.GetServiceUrls(service_type_, endpoints);
+}
+
+TEST_F(PolicyHandlerTest, ResetRetrySequence) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, ResetRetrySequence());
+ // Act
+ policy_handler_.ResetRetrySequence();
+}
+
+TEST_F(PolicyHandlerTest, NextRetryTimeout) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, NextRetryTimeout());
+ // Act
+ policy_handler_.NextRetryTimeout();
+}
+
+TEST_F(PolicyHandlerTest, TimeoutExchange) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, TimeoutExchange());
+ // Act
+ policy_handler_.TimeoutExchange();
+}
+
+TEST_F(PolicyHandlerTest, OnExceededTimeout) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, OnExceededTimeout());
+ // Act
+ policy_handler_.OnExceededTimeout();
+}
+
+TEST_F(PolicyHandlerTest, OnSystemReady) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, OnSystemReady());
+ // Act
+ policy_handler_.OnSystemReady();
+}
+
+TEST_F(PolicyHandlerTest, PTUpdatedAt_method_UseCounter_KILOMETERS) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ const int value = 1000;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, PTUpdatedAt(Counters::KILOMETERS, value));
+ // Act
+ policy_handler_.PTUpdatedAt(Counters::KILOMETERS, value);
+}
+
+TEST_F(PolicyHandlerTest, PTUpdatedAt_method_UseCounter_DAYS_AFTER_EPOCH) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ const int value = 16000;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_,
+ PTUpdatedAt(Counters::DAYS_AFTER_EPOCH, value));
+ // Act
+ policy_handler_.PTUpdatedAt(Counters::DAYS_AFTER_EPOCH, value);
+}
+
+TEST_F(PolicyHandlerTest, CheckSystemAction_method_WithType_KEEP_CONTEXT) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ mobile_apis::SystemAction::eType system_action =
+ mobile_apis::SystemAction::eType::KEEP_CONTEXT;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, CanAppKeepContext(kPolicyAppId_));
+ // Act
+ policy_handler_.CheckSystemAction(system_action, kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, CheckSystemAction_method_WithType_STEAL_FOCUS) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ mobile_apis::SystemAction::eType system_action =
+ mobile_apis::SystemAction::eType::STEAL_FOCUS;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, CanAppStealFocus(kPolicyAppId_));
+ // Act
+ policy_handler_.CheckSystemAction(system_action, kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, CheckSystemAction_method_WithType_DEFAULT_ACTION) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ mobile_apis::SystemAction::eType system_action =
+ mobile_apis::SystemAction::eType::DEFAULT_ACTION;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, CanAppStealFocus(kPolicyAppId_)).Times(0);
+ EXPECT_CALL(*mock_policy_manager_, CanAppKeepContext(kPolicyAppId_)).Times(0);
+ // Act
+ EXPECT_TRUE(policy_handler_.CheckSystemAction(system_action, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, CheckSystemAction_method_WithType_INVALID_ENUM) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ mobile_apis::SystemAction::eType system_action =
+ mobile_apis::SystemAction::eType::INVALID_ENUM;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, CanAppStealFocus(kPolicyAppId_)).Times(0);
+ EXPECT_CALL(*mock_policy_manager_, CanAppKeepContext(kPolicyAppId_)).Times(0);
+ // Act
+ EXPECT_FALSE(policy_handler_.CheckSystemAction(system_action, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, KmsChanged) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ const int kilometers = 1600;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, KmsChanged(kilometers));
+ // Act
+ policy_handler_.KmsChanged(kilometers);
+}
+// policy_handler l:1026
+
+void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
+ const uint32_t correlation_id) {
+ utils::SharedPtr<application_manager_test::MockApplication> application1 =
+ utils::MakeShared<application_manager_test::MockApplication>();
+ EXPECT_CALL(app_manager_, ActivateApplication(_))
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(app_manager_, application(connection_key))
+ .WillRepeatedly(Return(application1));
+
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appPermissionsConsentNeeded = true;
+
+ // Check expectations
+ EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+ ON_CALL(*mock_policy_manager_, Increment(_, _)).WillByDefault(Return());
+ EXPECT_CALL(*mock_policy_manager_, RemovePendingPermissionChanges(_));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendSDLActivateAppResponse(_, _, _));
+ ON_CALL(*application1, app_id()).WillByDefault(Return(kAppId_));
+ // Act
+ policy_handler_.OnActivateApp(connection_key, correlation_id);
+}
+
+TEST_F(PolicyHandlerTest, OnActivateApp) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ const uint32_t connection_key = 1;
+ const uint32_t correlation_id = 2;
+ TestActivateApp(connection_key, correlation_id);
+}
+
+TEST_F(PolicyHandlerTest, OnIgnitionCycleOver) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, IncrementIgnitionCycles());
+ // Act
+ policy_handler_.OnIgnitionCycleOver();
+}
+
+void PolicyHandlerTest::OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType hmi_level) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ utils::SharedPtr<application_manager_test::MockApplication> application =
+ utils::MakeShared<application_manager_test::MockApplication>();
+
+ EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ .WillOnce(Return(application));
+ EXPECT_CALL(*application, app_id()).WillRepeatedly(Return(kAppId_));
+ EXPECT_CALL(*application, hmi_level()).WillRepeatedly(Return(hmi_level));
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPendingPermissionChange_AppInLimitedConsentnotNeeded) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_LIMITED);
+ // Check expectations
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appPermissionsConsentNeeded = false;
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _)).Times(0);
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_)).Times(0);
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInLimitedConsentNeeded) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_LIMITED);
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appPermissionsConsentNeeded = true;
+ // Check expectations
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _));
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_));
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_LIMITED);
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appRevoked = true;
+
+ // Check expectations
+ EXPECT_CALL(app_manager_, state_controller())
+ .WillRepeatedly(ReturnRef(mock_state_controller));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_,
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ true));
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_));
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInBackgroundAndRevoked) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_BACKGROUND);
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.isAppPermissionsRevoked = true;
+
+ // Check expectations
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _));
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_));
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPendingPermissionChange_AppInLIMITEDAndUnauthorized) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_LIMITED);
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appUnauthorized = true;
+
+ NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message =
+ utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>();
+ // Check expectations
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _));
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ GetOnAppInterfaceUnregisteredNotificationToMobile(
+ kAppId_,
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED))
+ .WillOnce(Return(message));
+ EXPECT_CALL(app_manager_,
+ ManageMobileCommand(_, commands::Command::ORIGIN_SDL));
+
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_));
+
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnPendingPermissionChange_AppInBackgroundAndUnauthorized) {
+ // Arrange
+ OnPendingPermissionChangePrecondition(
+ mobile_apis::HMILevel::eType::HMI_BACKGROUND);
+ AppPermissions permissions(kPolicyAppId_);
+ permissions.appUnauthorized = true;
+
+ NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message =
+ utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>();
+ // Check expectations
+ // Notification won't be sent
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(kAppId_, _, _)).Times(0);
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ .WillOnce(Return(permissions));
+
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ GetOnAppInterfaceUnregisteredNotificationToMobile(
+ kAppId_,
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED))
+ .WillOnce(Return(message));
+ EXPECT_CALL(app_manager_,
+ ManageMobileCommand(_, commands::Command::ORIGIN_SDL));
+
+ EXPECT_CALL(*mock_policy_manager_,
+ RemovePendingPermissionChanges(kPolicyAppId_));
+
+ // Act
+ policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, PTExchangeAtUserRequest) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, ForcePTExchange());
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendUpdateSDLResponse(_, _, _));
+ // Act
+ const uint32_t correlation_id = 2;
+ policy_handler_.PTExchangeAtUserRequest(correlation_id);
+}
+
+TEST_F(PolicyHandlerTest, AddDevice) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ const std::string connection_type("BT");
+ EXPECT_CALL(*mock_policy_manager_, AddDevice(kDeviceId_, connection_type));
+ // Act
+ policy_handler_.AddDevice(kDeviceId_, connection_type);
+}
+
+TEST_F(PolicyHandlerTest, SetDeviceInfo) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ std::string kDeviceId_;
+ const DeviceInfo device_info;
+ EXPECT_CALL(*mock_policy_manager_, SetDeviceInfo(kDeviceId_, _));
+ // Act
+ policy_handler_.SetDeviceInfo(kDeviceId_, device_info);
+}
+
+TEST_F(PolicyHandlerTest, OnGetUserFriendlyMessage) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ std::vector<std::string> message_codes;
+ const std::string language("ru-ru");
+ const uint32_t correlation_id = 2;
+ EXPECT_CALL(*mock_policy_manager_,
+ GetUserFriendlyMessages(message_codes, language))
+ .WillOnce(Return(std::vector<UserFriendlyMessage>()));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendGetUserFriendlyMessageResponse(_, _, _));
+ // Act
+ policy_handler_.OnGetUserFriendlyMessage(
+ message_codes, language, correlation_id);
+}
+
+TEST_F(PolicyHandlerTest, OnGetStatusUpdate) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ const uint32_t correlation_id = 2;
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetPolicyTableStatus());
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendGetStatusUpdateResponse(_, correlation_id, _));
+ // Act
+ policy_handler_.OnGetStatusUpdate(correlation_id);
+}
+
+TEST_F(PolicyHandlerTest, OnUpdateStatusChanged) {
+ // Check expectations
+ const std::string& status("new status");
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnStatusUpdate(status, _));
+ // Act
+ policy_handler_.OnUpdateStatusChanged(status);
+}
+
+TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ utils::SharedPtr<application_manager_test::MockApplication> application =
+ utils::MakeShared<application_manager_test::MockApplication>();
+ EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ .WillOnce(Return(application));
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+ protocol_handler_test::MockSessionObserver session_observer;
+
+ EXPECT_CALL(conn_handler, get_session_observer())
+ .WillOnce(ReturnRef(session_observer));
+
+ EXPECT_CALL(session_observer, GetDataOnDeviceID(0u, _, _, _, _));
+
+ // Act
+ policy_handler_.OnCurrentDeviceIdUpdateRequired(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnSystemInfoChanged) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ const std::string language("ru-ru");
+ EXPECT_CALL(*mock_policy_manager_, SetSystemLanguage(language));
+ // Act
+ policy_handler_.OnSystemInfoChanged(language);
+}
+
+TEST_F(PolicyHandlerTest, OnGetSystemInfo) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ const std::string ccpu_version("4.1.3.B_EB355B");
+ const std::string wers_country_code("WAEGB");
+ const std::string language("ru-ru");
+ EXPECT_CALL(*mock_policy_manager_,
+ SetSystemInfo(ccpu_version, wers_country_code, language));
+ // Act
+ policy_handler_.OnGetSystemInfo(ccpu_version, wers_country_code, language);
+}
+
+TEST_F(PolicyHandlerTest, IsApplicationRevoked) {
+ // Arrange
+ EnablePolicy();
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, IsApplicationRevoked(kPolicyAppId_));
+ // Act
+ policy_handler_.IsApplicationRevoked(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnSystemInfoUpdateRequired) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendGetSystemInfoRequest(_));
+ // Act
+ policy_handler_.OnSystemInfoUpdateRequired();
+}
+
+TEST_F(PolicyHandlerTest, GetAppRequestTypes) {
+ // Arrange
+ EnablePolicy();
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>()));
+ // Act
+ policy_handler_.GetAppRequestTypes(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnVIIsReady) {
+ // Arrange
+ ChangePolicyManagerToMock();
+ // Check expectations
+ EXPECT_CALL(app_manager_, GetNextHMICorrelationID());
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ CreateGetVehicleDataRequest(_, _, _));
+ // Act
+ policy_handler_.OnVIIsReady();
+}
+
+TEST_F(PolicyHandlerTest, RemoveDevice) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, MarkUnpairedDevice(kDeviceId_));
+ // Act
+ policy_handler_.RemoveDevice(kDeviceId_);
+}
+
+TEST_F(PolicyHandlerTest, GetAppName) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ const CustomString app_name("my_mobile_app");
+
+ utils::SharedPtr<application_manager_test::MockApplication> application =
+ utils::MakeShared<application_manager_test::MockApplication>();
+
+ EXPECT_CALL(*application, name()).WillOnce(ReturnRef(app_name));
+ EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ .WillOnce(Return(application));
+ // Act
+ EXPECT_EQ(app_name, policy_handler_.GetAppName(kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, OnUpdateRequestSentToMobile) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, OnUpdateStarted());
+ // Act
+ policy_handler_.OnUpdateRequestSentToMobile();
+}
+
+TEST_F(PolicyHandlerTest, OnUpdateHMIAppType) {
+ // Arrange
+ EnablePolicy();
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+ std::map<std::string, StringArray> app_hmi_types;
+ StringArray arr;
+ arr.push_back("test_hmi_type");
+ app_hmi_types["app1"] = arr;
+ // Check expectations
+ EXPECT_CALL(policy_handler_observer, OnUpdateHMIAppType(_));
+ // Act
+ policy_handler_.OnUpdateHMIAppType(app_hmi_types);
+}
+
+TEST_F(PolicyHandlerTest, SendOnAppPermissionsChanged) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ utils::SharedPtr<application_manager_test::MockApplication> application =
+ utils::MakeShared<application_manager_test::MockApplication>();
+ // Check expectations
+ EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ .WillOnce(Return(application));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnAppPermissionsChangedNotification(_, _, _));
+ AppPermissions permissions(kPolicyAppId_);
+ // Act
+ policy_handler_.SendOnAppPermissionsChanged(permissions, kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnPTExchangeNeeded) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, ForcePTExchange());
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendOnStatusUpdate(_, _));
+ // Act
+ policy_handler_.OnPTExchangeNeeded();
+}
+
+TEST_F(PolicyHandlerTest, AddApplication) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, AddApplication(kPolicyAppId_));
+ // Act
+ policy_handler_.AddApplication(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, HeartBeatTimeout) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, HeartBeatTimeout(kPolicyAppId_));
+ // Act
+ policy_handler_.HeartBeatTimeout(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, OnAppsSearchStarted) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, OnAppsSearchStarted());
+ // Act
+ policy_handler_.OnAppsSearchStarted();
+}
+
+TEST_F(PolicyHandlerTest, OnAppsSearchCompleted) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, OnAppsSearchCompleted());
+ // Act
+ policy_handler_.OnAppsSearchCompleted();
+}
+
+TEST_F(PolicyHandlerTest, OnAppRegisteredOnMobile) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+
+ EXPECT_CALL(*mock_policy_manager_, OnAppRegisteredOnMobile(kPolicyAppId_));
+ // Act
+ policy_handler_.OnAppRegisteredOnMobile(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, IsRequestTypeAllowed) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+
+ mobile_apis::RequestType::eType type =
+ mobile_apis::RequestType::eType::EMERGENCY;
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>()));
+ // Act
+ policy_handler_.IsRequestTypeAllowed(kPolicyAppId_, type);
+}
+
+TEST_F(PolicyHandlerTest, GetVehicleInfo) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ EXPECT_CALL(*mock_policy_manager_, GetVehicleInfo())
+ .WillOnce(Return(VehicleInfo()));
+ // Act
+ policy_handler_.GetVehicleInfo();
+}
+
+TEST_F(PolicyHandlerTest, Increment_method_WithOneParameter) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+ usage_statistics::GlobalCounterId type =
+ usage_statistics::GlobalCounterId::IAP_BUFFER_FULL;
+ EXPECT_CALL(*mock_policy_manager_, Increment(type));
+ // Act
+ policy_handler_.Increment(type);
+}
+
+TEST_F(PolicyHandlerTest, Increment_method_WithTwoParameters) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+
+ usage_statistics::AppCounterId type =
+ usage_statistics::AppCounterId::USER_SELECTIONS;
+ EXPECT_CALL(*mock_policy_manager_, Increment(kPolicyAppId_, type));
+ // Act
+ policy_handler_.Increment(kPolicyAppId_, type);
+}
+
+TEST_F(PolicyHandlerTest, Set) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+
+ const std::string value("ru-ru");
+ usage_statistics::AppInfoId type = usage_statistics::AppInfoId::LANGUAGE_GUI;
+ EXPECT_CALL(*mock_policy_manager_, Set(kPolicyAppId_, type, value));
+ // Act
+ policy_handler_.Set(kPolicyAppId_, type, value);
+}
+
+TEST_F(PolicyHandlerTest, Add) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ // Check expectations
+
+ const int32_t timespan_seconds = 100;
+ usage_statistics::AppStopwatchId type =
+ usage_statistics::AppStopwatchId::SECONDS_HMI_FULL;
+ EXPECT_CALL(*mock_policy_manager_,
+ Add(kPolicyAppId_, type, timespan_seconds));
+ // Act
+ policy_handler_.Add(kPolicyAppId_, type, timespan_seconds);
+}
+
+TEST_F(PolicyHandlerTest, GetAvailableApps) {
+ // Set does not have any apps
+ std::queue<std::string> apps;
+ policy_handler_.GetAvailableApps(apps);
+ EXPECT_EQ(0u, apps.size());
+
+ // Added one app
+ test_app.insert(mock_app_);
+
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return("app_id"));
+
+ policy_handler_.GetAvailableApps(apps);
+
+ EXPECT_EQ(1u, apps.size());
+}
+
+TEST_F(PolicyHandlerTest, OnGetListOfPermissions) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ const uint32_t kAppId_ = 10u;
+ const uint32_t kCorId = 1u;
+ const std::string default_mac = "00:00:00:00:00:00";
+ test_app.insert(mock_app_);
+
+ // Expectations
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForApp(default_mac, _, _));
+
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendGetListOfPermissionsResponse(_, kCorId, _));
+
+ EXPECT_CALL(app_manager_, application(kAppId_))
+ .WillRepeatedly(Return(mock_app_));
+
+ policy_handler_.OnGetListOfPermissions(kAppId_, kCorId);
+}
+
+TEST_F(PolicyHandlerTest, OnGetListOfPermissions_WithoutConnectionKey) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ const uint32_t kAppId_ = 0u;
+ const uint32_t kCorId = 1u;
+ test_app.insert(mock_app_);
+
+ // Expectations
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendGetListOfPermissionsResponse(_, kCorId, _));
+
+ policy_handler_.OnGetListOfPermissions(kAppId_, kCorId);
+}
+
+TEST_F(PolicyHandlerTest, RetrieveCertificate) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+ const std::string test_certificate = "test certificate";
+ EXPECT_CALL(*mock_policy_manager_, RetrieveCertificate())
+ .WillOnce(Return(test_certificate));
+ EXPECT_EQ(test_certificate, policy_handler_.RetrieveCertificate());
+}
+
+TEST_F(PolicyHandlerTest, OnSnapshotCreated_UrlNotAdded) {
+ EnablePolicyAndPolicyManagerMock();
+ BinaryMessage msg;
+ EndpointUrls test_data;
+#ifdef EXTENDED_POLICY
+ ExtendedPolicyExpectations();
+#else
+ EXPECT_CALL(*mock_policy_manager_, GetServiceUrls(_, _))
+ .WillRepeatedly(SetArgReferee<1>(test_data));
+#endif // EXTENDED_POLICY
+
+ policy_handler_.OnSnapshotCreated(msg);
+}
+
+TEST_F(PolicyHandlerTest, OnSnapshotCreated_UrlAdded) {
+ EnablePolicyAndPolicyManagerMock();
+ BinaryMessage msg;
+ EndpointUrls test_data;
+ EndpointData data("some_data");
+ test_data.push_back(data);
+
+#ifdef EXTENDED_POLICY
+ ExtendedPolicyExpectations();
+#else
+ EXPECT_CALL(*mock_policy_manager_, GetServiceUrls(_, _))
+ .WillRepeatedly(SetArgReferee<1>(test_data));
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+ EXPECT_CALL(conn_handler, get_session_observer())
+ .WillOnce(ReturnRef(mock_session_observer));
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0));
+ EXPECT_CALL(app_manager_, applications()).WillOnce(Return(app_set));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendPolicySnapshotNotification(_, _, _, _));
+ // Check expectations for get app id
+ GetAppIDForSending();
+ // Expectations
+ EXPECT_CALL(app_manager_, application(kAppId_))
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+#endif // EXTENDED_POLICY
+
+ policy_handler_.OnSnapshotCreated(msg);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnAllowSDLFunctionalityNotification_AllowedWithDevId_AppActivated) {
+ // Arrange
+
+ EnablePolicyAndPolicyManagerMock();
+ const uint32_t connection_key = 1;
+ const uint32_t correlation_id = 2;
+ TestActivateApp(connection_key, correlation_id);
+
+ const bool is_allowed = true;
+ std::vector<std::string> device_macs;
+ device_macs.push_back(kPolicyAppId_);
+
+ // Not called because id was setted
+ EXPECT_CALL(conn_handler, GetConnectedDevicesMAC(_)).Times(0);
+ EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ .WillRepeatedly(Return(true));
+
+ policy_handler_.OnAllowSDLFunctionalityNotification(is_allowed,
+ kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest,
+ OnAllowSDLFunctionalityNotification_Allowed_WithoutDevId_AppActivated) {
+ // Arrange
+ const bool is_allowed = true;
+ std::vector<std::string> device_macs;
+ device_macs.push_back(kPolicyAppId_);
+ EnablePolicyAndPolicyManagerMock();
+ const uint32_t connection_key = 1;
+ const uint32_t correlation_id = 2;
+ TestActivateApp(connection_key, correlation_id);
+
+ // Device ID is not setted by us
+ EXPECT_CALL(conn_handler, GetConnectedDevicesMAC(_))
+ .WillOnce(SetArgReferee<0>(device_macs));
+
+ EXPECT_CALL(*mock_policy_manager_,
+ SetUserConsentForDevice(kPolicyAppId_, is_allowed));
+
+ policy_handler_.OnAllowSDLFunctionalityNotification(is_allowed, "");
+}
+
+TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
+ const bool is_allowed = true;
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ connection_handler::DeviceHandle test_device_id = 100u;
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+
+ EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
+
+ test_app.insert(mock_app_);
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(test_device_id));
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+
+ EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(*mock_policy_manager_,
+ ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
+ EXPECT_CALL(*mock_policy_manager_,
+ SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+
+ policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+}
+
+TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
+ const bool is_allowed = false;
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ connection_handler::DeviceHandle test_device_id = 100u;
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+
+ // Check expectations
+ EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
+ test_app.insert(mock_app_);
+
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(test_device_id));
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+
+ EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(*mock_policy_manager_, ReactOnUserDevConsentForApp(_, _))
+ .Times(0);
+ EXPECT_CALL(*mock_policy_manager_, SendNotificationOnPermissionsUpdated(_))
+ .Times(0);
+
+ policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+}
+
+TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
+ const bool is_allowed = false;
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ connection_handler::DeviceHandle test_device_id = 100u;
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+
+ EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
+
+ test_app.insert(mock_app_);
+
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(test_device_id));
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+
+ // App does not have predate policy
+ EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(*mock_policy_manager_,
+ ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
+ EXPECT_CALL(*mock_policy_manager_,
+ SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+
+ policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+}
+
+TEST_F(PolicyHandlerTest, OnCertificateUpdated) {
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+ std::string cert_data = "data";
+ EXPECT_CALL(policy_handler_observer, OnCertificateUpdated(cert_data));
+ policy_handler_.OnCertificateUpdated(cert_data);
+}
+
+TEST_F(PolicyHandlerTest, GetAppIdForSending_WithoutApps) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
+ // Set does not include any applications
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_)).Times(0);
+ EXPECT_EQ(0u, policy_handler_.GetAppIdForSending());
+}
+
+TEST_F(PolicyHandlerTest, GetAppIdForSending_GetDefaultMacAddress) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ // Set does not include any applications
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_)).Times(0);
+ // Check expectations
+ test_app.insert(mock_app_);
+ EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(app_manager_, connection_handler())
+ .WillOnce(ReturnRef(conn_handler));
+
+ EXPECT_CALL(conn_handler, get_session_observer())
+ .WillOnce(ReturnRef(mock_session_observer));
+
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
+
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
+ .WillRepeatedly(Return(kDeviceAllowed));
+ // Act
+ EXPECT_EQ(kAppId_, policy_handler_.GetAppIdForSending());
+}
+
+void PolicyHandlerTest::GetAppIDForSending() {
+ EnablePolicyAndPolicyManagerMock();
+ test_app.insert(mock_app_);
+
+ // Check expectations
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId_));
+ EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _))
+ .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0)));
+
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_))
+ .WillRepeatedly(Return(kDeviceAllowed));
+}
+
+TEST_F(PolicyHandlerTest, GetAppIdForSending_SetMacAddress) {
+ // Arrange
+ GetAppIDForSending();
+ // Act
+ EXPECT_EQ(kAppId_, policy_handler_.GetAppIdForSending());
+}
+
+TEST_F(PolicyHandlerTest, SendMessageToSDK) {
+ // Precondition
+ BinaryMessage msg;
+ const std::string url = "test_url";
+ EnablePolicyAndPolicyManagerMock();
+ test_app.insert(mock_app_);
+ // Check expectations for get app id
+ GetAppIDForSending();
+ // Expectations
+ EXPECT_CALL(app_manager_, application(kAppId_))
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendPolicySnapshotNotification(kAppId_, msg, url, _));
+ // Act
+ EXPECT_TRUE(policy_handler_.SendMessageToSDK(msg, url));
+}
+
+TEST_F(PolicyHandlerTest, CanUpdate) {
+ GetAppIDForSending();
+ EXPECT_TRUE(policy_handler_.CanUpdate());
+}
+
+} // namespace policy_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc
new file mode 100644
index 0000000000..6d08e5bf56
--- /dev/null
+++ b/src/components/application_manager/test/request_controller/request_controller_test.cc
@@ -0,0 +1,186 @@
+/*
+ * 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/request_controller.h"
+#include "application_manager/mock_request.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/application_impl.h"
+#include "utils/make_shared.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "resumption/last_state.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_application_manager.h"
+
+namespace test {
+namespace components {
+namespace request_controller_test {
+
+using application_manager::request_controller::RequestController;
+using application_manager::request_controller::RequestInfo;
+
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+typedef utils::SharedPtr<application_manager_test::MockRequest> RequestPtr;
+typedef utils::SharedPtr<RequestController> RequestControllerSPtr;
+
+class RequestControllerTestClass : public ::testing::Test {
+ public:
+ RequestControllerTestClass()
+ : request_ctrl_(utils::MakeShared<RequestController>(
+ mock_request_controller_settings_)) {
+ register_request_ = GetMockRequest();
+ }
+
+ RequestController::TResult AddRequest(
+ const RequestInfo::RequestType request_type,
+ const bool RegisterRequest = false,
+ const mobile_apis::HMILevel::eType& hmi_level =
+ mobile_apis::HMILevel::INVALID_ENUM) {
+ RequestPtr request;
+ if (RegisterRequest) {
+ request = register_request_;
+ EXPECT_CALL(*register_request_, default_timeout()).WillOnce(Return(0));
+ } else {
+ request = empty_register_request_;
+ }
+ if (RequestInfo::RequestType::HMIRequest == request_type) {
+ return request_ctrl_->addHMIRequest(request);
+ }
+ return request_ctrl_->addMobileRequest(request, hmi_level);
+ }
+
+ RequestPtr GetMockRequest(const uint32_t id = 1,
+ const uint32_t connection_key = 0) {
+ return utils::MakeShared<application_manager_test::MockRequest>(
+ connection_key, id);
+ }
+ void CallSettings() {
+ EXPECT_CALL(mock_request_controller_settings_,
+ app_hmi_level_none_time_scale())
+ .WillOnce(ReturnRef(kDefaultAppHmiLevelNoneRequestsTimeScale));
+ EXPECT_CALL(mock_request_controller_settings_,
+ app_hmi_level_none_time_scale_max_requests())
+ .WillOnce(ReturnRef(kDefaultAppHmiLevelNoneTimeScaleMaxRequests));
+
+ EXPECT_CALL(mock_request_controller_settings_, app_time_scale())
+ .WillOnce(ReturnRef(kDefaultAppRequestsTimeScale));
+ EXPECT_CALL(mock_request_controller_settings_,
+ app_time_scale_max_requests())
+ .WillOnce(ReturnRef(kDefaultAppTimeScaleMaxRequests));
+
+ EXPECT_CALL(mock_request_controller_settings_, pending_requests_amount())
+ .WillOnce(ReturnRef(kDefaultPendingRequestsAmount));
+ }
+
+ application_manager_test::MockRequestControlerSettings
+ mock_request_controller_settings_;
+ RequestPtr register_request_;
+ RequestPtr empty_register_request_;
+ RequestControllerSPtr request_ctrl_;
+
+ const uint32_t kDefaultAppHmiLevelNoneRequestsTimeScale = 10;
+ const uint32_t kDefaultAppHmiLevelNoneTimeScaleMaxRequests = 100u;
+ const uint32_t kDefaultAppTimeScaleMaxRequests = 0;
+ const uint32_t kDefaultAppRequestsTimeScale = 0;
+ const uint32_t kDefaultPendingRequestsAmount = 0;
+};
+
+TEST_F(RequestControllerTestClass, CheckPosibilitytoAdd_HMI_FULL_SUCCESS) {
+ CallSettings();
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
+ AddRequest(RequestInfo::RequestType::MobileRequest,
+ true,
+ mobile_apis::HMILevel::HMI_FULL));
+}
+
+TEST_F(RequestControllerTestClass, CheckPosibilitytoAdd_HMI_NONE_SUCCESS) {
+ CallSettings();
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
+ AddRequest(RequestInfo::RequestType::MobileRequest,
+ true,
+ mobile_apis::HMILevel::HMI_NONE));
+}
+
+TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnLowVoltage_TRUE) {
+ request_ctrl_->OnLowVoltage();
+ const bool result = true;
+ EXPECT_EQ(result, request_ctrl_->IsLowVoltage());
+}
+
+TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnWakeUp_FALSE) {
+ request_ctrl_->OnWakeUp();
+ const bool result = false;
+ EXPECT_EQ(result, request_ctrl_->IsLowVoltage());
+}
+
+TEST_F(RequestControllerTestClass,
+ AddMobileRequest_SetInvalidData_INVALID_DATA) {
+ EXPECT_EQ(RequestController::INVALID_DATA,
+ AddRequest(RequestInfo::RequestType::MobileRequest,
+ false,
+ mobile_apis::HMILevel::HMI_NONE));
+}
+
+TEST_F(RequestControllerTestClass, addHMIRequest_AddRequest_SUCCESS) {
+ EXPECT_EQ(RequestController::SUCCESS,
+ AddRequest(RequestInfo::RequestType::HMIRequest, true));
+}
+
+TEST_F(RequestControllerTestClass, addHMIRequest_AddInvalidData_INVALID_DATA) {
+ EXPECT_EQ(RequestController::INVALID_DATA,
+ AddRequest(RequestInfo::RequestType::HMIRequest));
+}
+
+TEST_F(RequestControllerTestClass, ZeroValuePendingRequestsAmount) {
+ // Bigger than pending_requests_amount count
+ const uint32_t big_count_of_requests_for_test_ = 10;
+ for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
+ CallSettings();
+ EXPECT_EQ(RequestController::SUCCESS,
+ AddRequest(RequestInfo::RequestType::MobileRequest,
+ true,
+ mobile_apis::HMILevel::HMI_FULL));
+ }
+}
+
+} // namespace request_controller
+} // namespace components
+} // namespace test
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/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index bfd41b0f08..9857072674 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_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
@@ -35,14 +35,18 @@
#include <algorithm>
#include "gtest/gtest.h"
#include "application_manager/usage_statistics.h"
-#include "include/application_mock.h"
-#include "include/resumption_data_mock.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_resumption_data.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"
+#include "utils/make_shared.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_state_controller.h"
namespace test {
namespace components {
@@ -50,48 +54,77 @@ namespace resumption_test {
using ::testing::_;
using ::testing::Return;
+using ::testing::ReturnRef;
using ::testing::DoAll;
using ::testing::SetArgReferee;
using ::testing::Mock;
using ::testing::NiceMock;
using ::testing::AtLeast;
+using namespace application_manager_test;
using namespace resumption;
using namespace mobile_apis::HMILevel;
class ResumeCtrlTest : public ::testing::Test {
- public:
+ protected:
+ ResumeCtrlTest()
+ : kTestAppId_(10u)
+ , kTestPolicyAppId_("test_policy_app_id")
+ , kMacAddress_("12345")
+ , kDefaultTestLevel_(eType::HMI_NONE)
+ , kCorId_(7u)
+ , kTestDevId_(5u)
+ , kTestGrammarId_(10)
+ , kHash_("saved_hash")
+ , kAppResumingTimeout_(30000000u) {}
+
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";
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(mock_event_dispatcher_));
+ mock_storage =
+ ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData>>(
+ app_mngr_);
+ app_mock = utils::MakeShared<NiceMock<MockApplication>>();
+ res_ctrl = utils::MakeShared<ResumeCtrl>(app_mngr_);
+ res_ctrl->set_resumption_storage(mock_storage);
+
+ ON_CALL(app_mngr_, state_controller())
+ .WillByDefault(ReturnRef(state_controller_));
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(mock_application_manager_settings_));
+
+ ON_CALL(mock_application_manager_settings_, use_db_for_resumption())
+ .WillByDefault(Return(false));
+ ON_CALL(mock_application_manager_settings_, app_resuming_timeout())
+ .WillByDefault(ReturnRef(kAppResumingTimeout_));
+ }
+ void GetInfoFromApp() {
+ ON_CALL(*app_mock, policy_app_id())
+ .WillByDefault(Return(kTestPolicyAppId_));
+ ON_CALL(*app_mock, mac_address()).WillByDefault(ReturnRef(kMacAddress_));
+ ON_CALL(*app_mock, device()).WillByDefault(Return(kTestDevId_));
+ ON_CALL(*app_mock, app_id()).WillByDefault(Return(kTestAppId_));
}
- protected:
- application_manager::ApplicationManagerImpl* app_mngr;
- ResumeCtrl res_ctrl;
- NiceMock<ResumptionDataMock>* mock_storage;
- NiceMock<ApplicationMock>* app_mock;
- mobile_apis::AudioStreamingState::eType test_audio_state;
+ NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
+ application_manager_test::MockApplicationManagerSettings
+ mock_application_manager_settings_;
+ application_manager_test::MockApplicationManager app_mngr_;
+ MockStateController state_controller_;
+ utils::SharedPtr<ResumeCtrl> res_ctrl;
+ utils::SharedPtr<NiceMock<resumption_test::MockResumptionData>> mock_storage;
+ utils::SharedPtr<NiceMock<MockApplication>> app_mock;
// 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;
-
+ const uint32_t kTestAppId_;
+ const std::string kTestPolicyAppId_;
+ const std::string kMacAddress_;
+ const mobile_apis::HMILevel::eType kDefaultTestLevel_;
+ const uint32_t kCorId_;
// app_mock.Device() will return this value
- uint32_t test_dev_id;
- uint32_t test_grammar_id;
- std::string hash;
+ const uint32_t kTestDevId_;
+ const uint32_t kTestGrammarId_;
+ const std::string kHash_;
+ const uint32_t kAppResumingTimeout_;
};
/**
@@ -100,17 +133,20 @@ class ResumeCtrlTest : public ::testing::Test {
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;
+ saved_app[application_manager::strings::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
// Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
+ GetInfoFromApp();
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_storage,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
+ EXPECT_CALL(*app_mock, set_grammar_id(kTestGrammarId_));
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
@@ -123,20 +159,23 @@ MATCHER_P4(CheckAppFile, is_persistent, is_download, file_name, file_type, "") {
TEST_F(ResumeCtrlTest, StartResumption_WithoutGrammarId) {
smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
+ saved_app[application_manager::strings::hash_id] = kHash_;
+ GetInfoFromApp();
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
// 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);
+ EXPECT_CALL(*app_mock, set_grammar_id(kTestGrammarId_)).Times(0);
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_FALSE(res);
}
TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
+ GetInfoFromApp();
smart_objects::SmartObject test_application_files;
smart_objects::SmartObject test_file;
const uint32_t count_of_files = 8;
@@ -164,29 +203,33 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
}
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_files] =
test_application_files;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
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));
+ EXPECT_CALL(*app_mock, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_files; ++i) {
EXPECT_CALL(*app_mock,
AddFile(CheckAppFile(
- true, true, file_names[i],
+ true,
+ true,
+ file_names[i],
static_cast<mobile_apis::FileType::eType>(file_types[i]))));
}
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
+ GetInfoFromApp();
smart_objects::SmartObject test_application_submenues;
smart_objects::SmartObject test_submenu;
@@ -197,31 +240,37 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
}
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_submenus] =
test_application_submenues;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
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(*app_mock, set_grammar_id(kTestGrammarId_));
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(app_mngr_, GetNextHMICorrelationID())
+ .WillRepeatedly(Return(kCorId_));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddSubMenuRequestToHMI(_)).WillRepeatedly(Return(requests));
+ CreateAddSubMenuRequestToHMI(_, kCorId_))
+ .WillRepeatedly(Return(requests));
EXPECT_CALL(*app_mock, UpdateHash());
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
+ GetInfoFromApp();
smart_objects::SmartObject test_application_commands;
smart_objects::SmartObject test_commands;
const uint32_t count_of_commands = 20;
@@ -232,17 +281,18 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
}
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_commands] =
test_application_commands;
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
// 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));
+ EXPECT_CALL(*app_mock, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_commands; ++i) {
EXPECT_CALL(*app_mock, AddCommand(i, test_application_commands[i]));
@@ -250,9 +300,10 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
smart_objects::SmartObjectList requests;
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddCommandRequestToHMI(_)).WillRepeatedly(Return(requests));
+ CreateAddCommandRequestToHMI(_, _))
+ .WillRepeatedly(Return(requests));
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
@@ -280,17 +331,19 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
}
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_choice_sets] =
application_choice_sets;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
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));
+ EXPECT_CALL(*app_mock, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
EXPECT_CALL(*app_mock, AddChoiceSet(i, application_choice_sets[i]));
@@ -301,7 +354,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
CreateAddVRCommandRequestFromChoiceToHMI(_))
.WillRepeatedly(Return(requests));
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
@@ -309,17 +362,19 @@ 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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_global_properties] =
test_global_properties;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
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(*app_mock, set_grammar_id(kTestGrammarId_));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
SendGlobalPropertiesToHMI(_));
@@ -327,7 +382,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
EXPECT_CALL(*app_mock, load_global_properties(test_global_properties));
EXPECT_CALL(*app_mock, UpdateHash());
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
@@ -345,28 +400,31 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_subscribtions] =
test_subscriptions;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
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(*app_mock, set_grammar_id(kTestGrammarId_));
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,
+ SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(i)));
}
EXPECT_CALL(*app_mock, UpdateHash());
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendAllOnButtonSubscriptionNotificationsForApp(_)).Times(2);
+ SendAllOnButtonSubscriptionNotificationsForApp(_, _)).Times(2);
- bool res = res_ctrl.StartResumption(app_mock, hash);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
EXPECT_TRUE(res);
}
@@ -386,17 +444,19 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
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::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::application_subscribtions] =
test_subscriptions;
// Check RestoreApplicationData
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
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(*app_mock, set_grammar_id(kTestGrammarId_));
for (size_t i = 0; i < app_vi.length(); ++i) {
EXPECT_CALL(
@@ -404,97 +464,62 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
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);
+ bool res = res_ctrl->StartResumption(app_mock, kHash_);
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, _, _))
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillOnce(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
+ EXPECT_CALL(*mock_storage, GetSavedApplication(kTestPolicyAppId_, _, _))
.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);
+ bool res = res_ctrl->StartResumptionOnlyHMILevel(app_mock);
EXPECT_TRUE(res);
}
TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
- mobile_apis::HMILevel::eType restored_testType = eType::HMI_FULL;
+ mobile_apis::HMILevel::eType restored_test_type = 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));
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
- 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)
+ EXPECT_CALL(state_controller_, SetRegularState(_, restored_test_type))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ EXPECT_CALL(*mock_storage, GetSavedApplication(kTestPolicyAppId_, _, _))
.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"))
+ 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);
+ 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;
+ mobile_apis::HMILevel::eType restored_test_type = eType::HMI_BACKGROUND;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = restored_testType;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
- 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, _, _))
+ EXPECT_CALL(app_mngr_, state_controller()).Times(0);
+ GetInfoFromApp();
+ EXPECT_CALL(*mock_storage, GetSavedApplication(kTestPolicyAppId_, _, _))
.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);
+ res_ctrl->StartAppHmiStateResumption(app_mock);
}
/**
@@ -502,320 +527,153 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInBackground) {
*/
TEST_F(ResumeCtrlTest, RestoreAppHMIState_RestoreHMILevelFull) {
- mobile_apis::HMILevel::eType restored_testType = eType::HMI_FULL;
+ mobile_apis::HMILevel::eType restored_test_type = 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;
+ saved_app[application_manager::strings::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
- 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(state_controller_, SetRegularState(_, restored_test_type))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
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(""))
+ EXPECT_CALL(app_mngr_, GetUserConsentForDevice("12345"))
.WillOnce(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillRepeatedly(Return(false));
+ EXPECT_CALL(*app_mock, set_is_resuming(true));
- 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);
+ 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;
+ saved_app[application_manager::strings::hmi_level] = kDefaultTestLevel_;
- 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));
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
+ EXPECT_CALL(app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillOnce(Return(kDefaultTestLevel_));
- 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);
+ EXPECT_CALL(state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ .Times(AtLeast(1));
- res_ctrl.SetupDefaultHMILevel(app_mock);
+ 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));
+TEST_F(ResumeCtrlTest, SetAppHMIState_HMINone_WithoutCheckPolicy) {
+ GetInfoFromApp();
- 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);
+ EXPECT_CALL(app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, default_testType, false);
+ EXPECT_CALL(*app_mock, set_is_resuming(true));
+ EXPECT_CALL(state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ .Times(AtLeast(1));
+ bool res = res_ctrl->SetAppHMIState(app_mock, kDefaultTestLevel_, 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));
+TEST_F(ResumeCtrlTest, SetAppHMIState_HMILimited_WithoutCheckPolicy) {
+ mobile_apis::HMILevel::eType test_type = eType::HMI_LIMITED;
+ GetInfoFromApp();
+ EXPECT_CALL(app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
+ EXPECT_CALL(*app_mock, set_is_resuming(true));
+ EXPECT_CALL(state_controller_, SetRegularState(_, test_type))
+ .Times(AtLeast(1));
+ bool res = res_ctrl->SetAppHMIState(app_mock, test_type, 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));
-
+TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithoutCheckPolicy) {
+ mobile_apis::HMILevel::eType test_type = eType::HMI_FULL;
+ GetInfoFromApp();
// 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_, GetDefaultHmiLevel(_)).Times(0);
+ EXPECT_CALL(app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- EXPECT_CALL(*app_mngr, SetState(test_app_id, testType, test_audio_state));
+ EXPECT_CALL(*app_mock, set_is_resuming(true));
+ EXPECT_CALL(state_controller_, SetRegularState(_, test_type))
+ .Times(AtLeast(1));
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
+ bool res = res_ctrl->SetAppHMIState(app_mock, test_type, 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_WithPolicy_DevAllowed) {
+ mobile_apis::HMILevel::eType test_type = eType::HMI_FULL;
-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"))
+ GetInfoFromApp();
+ 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));
+ EXPECT_CALL(*app_mock, set_is_resuming(true));
+ EXPECT_CALL(state_controller_, SetRegularState(_, test_type))
+ .Times(AtLeast(1));
- 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);
+ bool res = res_ctrl->SetAppHMIState(app_mock, test_type, true);
EXPECT_TRUE(res);
}
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_Media_WithPolicy_DevDisallowed) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
+TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevDisallowed) {
+ mobile_apis::HMILevel::eType test_type = eType::HMI_FULL;
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
+ GetInfoFromApp();
+ 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_CALL(*app_mock, set_is_resuming(true));
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillOnce(Return(kDefaultTestLevel_));
+ EXPECT_CALL(state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ .Times(AtLeast(1));
+ bool res = res_ctrl->SetAppHMIState(app_mock, test_type, true);
EXPECT_FALSE(res);
}
TEST_F(ResumeCtrlTest, SaveApplication) {
utils::SharedPtr<application_manager::Application> app_sh_mock =
- new ApplicationMock();
+ ::utils::MakeShared<application_manager_test::MockApplication>();
EXPECT_CALL(*mock_storage, SaveApplication(app_sh_mock));
- res_ctrl.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, _, _))
+ GetInfoFromApp();
+
+ EXPECT_CALL(app_mngr_, GetDefaultHmiLevel(_))
+ .WillOnce(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_storage, GetSavedApplication(kTestPolicyAppId_, _, _))
.WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
+ ON_CALL(*app_mock, app_id()).WillByDefault(Return(kTestAppId_));
- bool res = res_ctrl.StartResumptionOnlyHMILevel(app_mock);
+ bool res = res_ctrl->StartResumptionOnlyHMILevel(app_mock);
EXPECT_TRUE(res);
- utils::SharedPtr<ApplicationMock> app_sh_mock = new ApplicationMock();
+ utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock =
+ ::utils::MakeShared<application_manager_test::MockApplication>();
- EXPECT_CALL(*app_sh_mock, app_id()).WillOnce(Return(test_app_id));
- res_ctrl.OnAppActivated(app_sh_mock);
+ EXPECT_CALL(*app_sh_mock, app_id()).WillOnce(Return(kTestAppId_));
+ res_ctrl->OnAppActivated(app_sh_mock);
}
TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionNotActive) {
- utils::SharedPtr<ApplicationMock> app_sh_mock = new ApplicationMock();
+ utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock =
+ ::utils::MakeShared<application_manager_test::MockApplication>();
EXPECT_CALL(*app_sh_mock, app_id()).Times(0);
- res_ctrl.OnAppActivated(app_sh_mock);
+ res_ctrl->OnAppActivated(app_sh_mock);
}
TEST_F(ResumeCtrlTest, IsHMIApplicationIdExist) {
@@ -823,17 +681,17 @@ TEST_F(ResumeCtrlTest, IsHMIApplicationIdExist) {
EXPECT_CALL(*mock_storage, IsHMIApplicationIdExist(hmi_app_id))
.WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.IsHMIApplicationIdExist(hmi_app_id));
+ 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))
+ EXPECT_CALL(*mock_storage, GetHMIApplicationID(kTestPolicyAppId_, device_id))
.WillOnce(Return(hmi_app_id));
EXPECT_EQ(hmi_app_id,
- res_ctrl.GetHMIApplicationID(test_policy_app_id, device_id));
+ res_ctrl->GetHMIApplicationID(kTestPolicyAppId_, device_id));
}
TEST_F(ResumeCtrlTest, IsApplicationSaved) {
@@ -842,7 +700,7 @@ TEST_F(ResumeCtrlTest, IsApplicationSaved) {
EXPECT_CALL(*mock_storage, IsApplicationSaved(policy_app_id, device_id))
.WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.IsApplicationSaved(policy_app_id, device_id));
+ EXPECT_TRUE(res_ctrl->IsApplicationSaved(policy_app_id, device_id));
}
TEST_F(ResumeCtrlTest, CheckPersistenceFiles_WithoutCommandAndChoiceSets) {
@@ -851,13 +709,11 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFiles_WithoutCommandAndChoiceSets) {
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));
-
+ GetInfoFromApp();
EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
.WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
+ EXPECT_TRUE(res_ctrl->CheckPersistenceFilesForResumption(app_mock));
}
TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithCommands) {
@@ -869,17 +725,15 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithCommands) {
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));
-
+ GetInfoFromApp();
EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
.WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- VerifyImageFiles(_, _))
+ VerifyImageFiles(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
+ EXPECT_TRUE(res_ctrl->CheckPersistenceFilesForResumption(app_mock));
}
TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) {
@@ -891,45 +745,43 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) {
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));
-
+ GetInfoFromApp();
EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
.WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
+ EXPECT_TRUE(res_ctrl->CheckPersistenceFilesForResumption(app_mock));
}
// TODO (VVeremjova) APPLINK-16718
TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) {
EXPECT_CALL(*mock_storage, OnSuspend());
- res_ctrl.OnSuspend();
+ res_ctrl->OnSuspend();
}
TEST_F(ResumeCtrlTest, OnAwake) {
+ uint32_t timeout = 10u;
+ EXPECT_CALL(mock_application_manager_settings_,
+ app_resumption_save_persistent_data_timeout())
+ .WillOnce(ReturnRef(timeout));
EXPECT_CALL(*mock_storage, OnAwake());
- res_ctrl.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));
+ GetInfoFromApp();
EXPECT_CALL(*mock_storage, RemoveApplicationFromSaved(_, _))
.WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.RemoveApplicationFromSaved(app_mock));
+ EXPECT_TRUE(res_ctrl->RemoveApplicationFromSaved(app_mock));
}
-TEST_F(ResumeCtrlTest, CheckApplicationHash) {
+TEST_F(ResumeCtrlTest, CheckApplicationkHash_) {
smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hash_id] = kHash_;
- 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, _, _))
+ GetInfoFromApp();
+ EXPECT_CALL(*mock_storage, GetSavedApplication(kTestPolicyAppId_, _, _))
.WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_TRUE(res_ctrl.CheckApplicationHash(app_mock, test_hash));
+ EXPECT_TRUE(res_ctrl->CheckApplicationHash(app_mock, kHash_));
}
} // namespace resumption_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..2fc1e5e5ec 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
@@ -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
@@ -33,15 +33,15 @@
#include <string>
#include <algorithm>
#include "gtest/gtest.h"
-#include "include/application_mock.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "interfaces/MOBILE_API.h"
#include "sql_database.h"
#include "sql_query.h"
-
-#include "application_manager/application_manager_impl.h"
-#include "config_profile/profile.h"
+#include "utils/make_shared.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 +51,8 @@ namespace components {
namespace resumption_test {
using ::testing::NiceMock;
+using ::testing::ReturnRef;
+using application_manager_test::MockApplication;
namespace am = application_manager;
using namespace file_system;
@@ -58,17 +60,14 @@ 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) {}
-};
-
+namespace {
+const std::string kPath =
+ file_system::CurrentWorkingDirectory() + "/" + "test_storage";
+}
class ResumptionDataDBTest : public ResumptionDataTest {
protected:
- virtual void SetUp() {
- app_mock = new NiceMock<ApplicationMock>();
+ void SetUp() OVERRIDE {
+ app_mock = utils::MakeShared<NiceMock<MockApplication> >();
policy_app_id_ = "test_policy_app_id";
app_id_ = 10;
is_audio_ = true;
@@ -78,7 +77,7 @@ class ResumptionDataDBTest : public ResumptionDataTest {
ign_off_count_ = 0;
grammar_id_ = 16;
}
- virtual void TearDown() {
+ void TearDown() OVERRIDE {
utils::dbms::SQLQuery query(test_db());
EXPECT_TRUE(query.Prepare(remove_all_tables));
EXPECT_TRUE(query.Exec());
@@ -87,12 +86,11 @@ class ResumptionDataDBTest : public ResumptionDataTest {
static void SetUpTestCase() {
kDatabaseName = "resumption";
if (is_in_file) {
- ::profile::Profile::instance()->config_file_name(
- "smartDeviceLink_test.ini");
- path_ = profile::Profile::instance()->app_storage_folder();
- CreateDirectory("./" + path_);
+ path_ = "test_storage";
+ CreateDirectory(file_system::CurrentWorkingDirectory() + "/" + path_);
+ CreateDirectory(kPath);
test_db_ = new utils::dbms::SQLDatabase(kDatabaseName);
- test_db_->set_path(path_ + "/");
+ test_db_->set_path(kPath + "/");
res_db_ = new TestResumptionDataDB(In_File_Storage);
} else {
res_db_ = new TestResumptionDataDB(In_Memory_Storage);
@@ -110,14 +108,17 @@ class ResumptionDataDBTest : public ResumptionDataTest {
static void TearDownTestCase() {
test_db_->Close();
if (is_in_file) {
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
RemoveDirectory("./" + path_, true);
}
delete res_db_;
}
- utils::dbms::SQLDatabase* test_db() { return test_db_; }
- std::string path() { return path_; }
+ utils::dbms::SQLDatabase* test_db() {
+ return test_db_;
+ }
+ std::string path() {
+ return path_;
+ }
void SetZeroIgnOffTime() {
utils::dbms::SQLQuery query(test_db());
@@ -128,11 +129,12 @@ class ResumptionDataDBTest : public ResumptionDataTest {
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';";
@@ -142,6 +144,7 @@ class ResumptionDataDBTest : public ResumptionDataTest {
const std::string remove_all_tables =
"DELETE FROM `resumption`; "
+ "DELETE FROM `subscribedForWayPoints`; "
"DELETE FROM `image`; "
"DELETE FROM `applicationChoiceSet`; "
"DELETE FROM `file`; "
@@ -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, kMacAddress_);
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(kMacAddress_, query.GetString(8));
EXPECT_EQ(is_audio_, query.GetBoolean(9));
}
@@ -348,7 +351,7 @@ void ResumptionDataDBTest::CheckSubmenuData() {
EXPECT_TRUE(select_submenu.Prepare(kSelectCountSubMenu));
BindId(select_submenu);
EXPECT_TRUE(select_submenu.Exec());
- EXPECT_EQ(count_of_submenues, select_submenu.GetUInteger(0));
+ EXPECT_EQ(kCountOfSubmenues_, select_submenu.GetUInteger(0));
EXPECT_TRUE(select_submenu.Prepare(kSelectSubMenu));
BindId(select_submenu);
@@ -371,7 +374,7 @@ void ResumptionDataDBTest::CheckCommandsData() {
EXPECT_TRUE(select_commands.Prepare(kSelectCountCommands));
BindId(select_commands);
EXPECT_TRUE(select_commands.Exec());
- EXPECT_EQ(count_of_commands, select_commands.GetUInteger(0));
+ EXPECT_EQ(kCountOfCommands_, select_commands.GetUInteger(0));
EXPECT_TRUE(select_commands.Prepare(kSelectCommands));
BindId(select_commands);
@@ -419,7 +422,7 @@ void ResumptionDataDBTest::CheckChoiceSetData() {
EXPECT_TRUE(select_choice_set.Prepare(kSelectCountChoiceSet));
BindId(select_choice_set);
EXPECT_TRUE(select_choice_set.Exec());
- EXPECT_EQ(count_of_choice_sets, select_choice_set.GetUInteger(0));
+ EXPECT_EQ(kCountOfChoiceSets_, select_choice_set.GetUInteger(0));
EXPECT_TRUE(select_choice_set.Prepare(kSelectChoiceSets));
int64_t app_set_key = 0;
@@ -507,7 +510,7 @@ void ResumptionDataDBTest::CheckAppFilesData() {
EXPECT_TRUE(query.Prepare(kSelectCountFiles));
BindId(query);
EXPECT_TRUE(query.Exec());
- EXPECT_EQ(count_of_files, query.GetUInteger(0));
+ EXPECT_EQ(kCountOfFiles_, query.GetUInteger(0));
EXPECT_TRUE(query.Prepare(kSelectFiles));
BindId(query);
@@ -528,7 +531,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, kMacAddress_);
}
TEST_F(ResumptionDataDBTest, Init) {
@@ -565,11 +568,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_, kMacAddress_));
sm::SmartObject remove_app;
EXPECT_FALSE(
- res_db()->GetSavedApplication(policy_app_id_, device_id_, remove_app));
+ res_db()->GetSavedApplication(policy_app_id_, kMacAddress_, remove_app));
EXPECT_TRUE(remove_app.empty());
}
@@ -608,7 +612,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_, kMacAddress_);
EXPECT_EQ(0, result);
}
@@ -616,8 +620,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_, kMacAddress_));
+ ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, kMacAddress_);
EXPECT_EQ(-1, result);
}
@@ -629,7 +634,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_, kMacAddress_, saved_app));
CheckSavedApp(saved_app);
}
@@ -651,9 +656,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(kMacAddress_, 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 +670,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_, kMacAddress_));
res_db()->GetDataForLoadResumeData(saved_app);
EXPECT_TRUE(saved_app.empty());
}
@@ -675,7 +682,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_, kMacAddress_, new_hmi_level);
hmi_level_ = new_hmi_level;
CheckSavedDB();
}
@@ -703,7 +710,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_, kMacAddress_));
}
TEST_F(ResumptionDataDBTest, GetHMIApplicationID_AppNotSaved) {
@@ -746,7 +753,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_, kMacAddress_);
EXPECT_EQ(-1, result);
}
@@ -804,7 +811,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_, kMacAddress_, test_hash));
EXPECT_EQ(hash_, test_hash);
}
@@ -832,6 +839,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(kMacAddress_, policy_app_id_));
+
+ am::smart_objects::SmartObject app;
+ EXPECT_TRUE(res_db()->GetSavedApplication(policy_app_id_, kMacAddress_, 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
index 24a16596eb..0f51d29e0e 100644
--- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
@@ -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
@@ -35,14 +35,14 @@
#include "gtest/gtest.h"
#include "application_manager/usage_statistics.h"
-#include "include/application_mock.h"
-#include "include/resumption_data_mock.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_resumption_data.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 "application_manager/resumption_data_test.h"
+#include "formatters/CFormatterJsonBase.h"
+
#include "utils/file_system.h"
#include "application_manager/resumption/resumption_data_json.h"
@@ -64,8 +64,11 @@ namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
class ResumptionDataJsonTest : public ResumptionDataTest {
protected:
+ ResumptionDataJsonTest()
+ : last_state_("app_storage_folder", "app_info_storage")
+ , res_json(last_state_, mock_application_manager_) {}
virtual void SetUp() {
- app_mock = new NiceMock<ApplicationMock>();
+ app_mock = new NiceMock<application_manager_test::MockApplication>();
policy_app_id_ = "test_policy_app_id";
app_id_ = 10;
@@ -78,7 +81,7 @@ class ResumptionDataJsonTest : public ResumptionDataTest {
}
void CheckSavedJson() {
- Value& dictionary = LastState::instance()->dictionary;
+ Value& dictionary = last_state_.dictionary;
ASSERT_TRUE(dictionary[am::strings::resumption].isObject());
ASSERT_TRUE(
dictionary[am::strings::resumption][am::strings::resume_app_list]
@@ -94,22 +97,23 @@ class ResumptionDataJsonTest : public ResumptionDataTest {
}
void SetZeroIgnOff() {
- Value& dictionary = LastState::instance()->dictionary;
+ Value& dictionary = last_state_.dictionary;
Value& res = dictionary[am::strings::resumption];
res[am::strings::last_ign_off_time] = 0;
- LastState::instance()->SaveToFileSystem();
+ last_state_.SaveToFileSystem();
}
+
+ resumption::LastState last_state_;
+ ResumptionDataJson res_json;
};
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();
@@ -118,7 +122,6 @@ TEST_F(ResumptionDataJsonTest, SavedApplicationTwice) {
}
TEST_F(ResumptionDataJsonTest, SavedApplicationTwice_UpdateApp) {
- ResumptionDataJson res_json;
PrepareData();
res_json.SaveApplication(app_mock);
CheckSavedJson();
@@ -129,54 +132,50 @@ TEST_F(ResumptionDataJsonTest, SavedApplicationTwice_UpdateApp) {
}
TEST_F(ResumptionDataJsonTest, RemoveApplicationFromSaved) {
- ResumptionDataJson res_json;
PrepareData();
res_json.SaveApplication(app_mock);
- EXPECT_TRUE(res_json.RemoveApplicationFromSaved(policy_app_id_, device_id_));
+ EXPECT_TRUE(
+ res_json.RemoveApplicationFromSaved(policy_app_id_, kMacAddress_));
// Check that application was deleted
smart_objects::SmartObject remove_app;
EXPECT_FALSE(
- res_json.GetSavedApplication(policy_app_id_, device_id_, remove_app));
+ res_json.GetSavedApplication(policy_app_id_, kMacAddress_, 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_);
+ ssize_t result = res_json.IsApplicationSaved(policy_app_id_, kMacAddress_);
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_TRUE(
+ res_json.RemoveApplicationFromSaved(policy_app_id_, kMacAddress_));
+ ssize_t result = res_json.IsApplicationSaved(policy_app_id_, kMacAddress_);
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));
+ res_json.GetSavedApplication(policy_app_id_, kMacAddress_, 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));
@@ -184,7 +183,6 @@ TEST_F(ResumptionDataJsonTest, GetSavedApplication_AppNotSaved) {
}
TEST_F(ResumptionDataJsonTest, GetDataForLoadResumeData) {
- ResumptionDataJson res_json;
PrepareData();
res_json.SaveApplication(app_mock);
CheckSavedJson();
@@ -192,38 +190,37 @@ TEST_F(ResumptionDataJsonTest, GetDataForLoadResumeData) {
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(kMacAddress_, 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_));
+ EXPECT_TRUE(
+ res_json.RemoveApplicationFromSaved(policy_app_id_, kMacAddress_));
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);
+ res_json.UpdateHmiLevel(policy_app_id_, kMacAddress_, new_hmi_level);
hmi_level_ = new_hmi_level;
CheckSavedJson();
}
TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppIsSaved) {
- ResumptionDataJson res_json;
PrepareData();
res_json.SaveApplication(app_mock);
CheckSavedJson();
@@ -231,7 +228,6 @@ TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppIsSaved) {
}
TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppNotSaved) {
- ResumptionDataJson res_json;
PrepareData();
res_json.SaveApplication(app_mock);
@@ -241,24 +237,20 @@ TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppNotSaved) {
}
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_));
+ res_json.GetHMIApplicationID(policy_app_id_, kMacAddress_));
}
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();
@@ -268,18 +260,10 @@ TEST_F(ResumptionDataJsonTest, OnSuspend) {
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();
@@ -292,20 +276,11 @@ TEST_F(ResumptionDataJsonTest, OnSuspendFourTimes) {
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");
+ EXPECT_TRUE(-1 != res_json.IsApplicationSaved(policy_app_id_, kMacAddress_));
}
TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) {
- ResumptionDataJson res_json;
PrepareData();
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
SetZeroIgnOff();
res_json.SaveApplication(app_mock);
CheckSavedJson();
@@ -317,13 +292,9 @@ TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) {
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);
@@ -335,7 +306,6 @@ TEST_F(ResumptionDataJsonTest, Awake_AppNotSuspended) {
}
TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) {
- ResumptionDataJson res_json;
SetZeroIgnOff();
PrepareData();
res_json.SaveApplication(app_mock);
@@ -351,21 +321,18 @@ TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) {
}
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_TRUE(res_json.GetHashId(policy_app_id_, kMacAddress_, 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();
@@ -383,10 +350,38 @@ TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
after_awake = res_json.GetIgnOffTime();
EXPECT_LE(after_suspend, after_awake);
+}
+
+TEST_F(ResumptionDataJsonTest, DropAppDataResumption) {
+ PrepareData();
+ SetZeroIgnOff();
+ res_json.SaveApplication(app_mock);
+ CheckSavedJson();
+
+ EXPECT_TRUE(res_json.DropAppDataResumption(kMacAddress_, policy_app_id_));
+
+ smart_objects::SmartObject app;
+ EXPECT_TRUE(res_json.GetSavedApplication(policy_app_id_, kMacAddress_, 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_TRUE(RemoveDirectory("./test_storage", true));
- EXPECT_TRUE(DeleteFile("./test_app_info.dat"));
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
+ EXPECT_FALSE(app.keyExists(am::strings::grammar_id));
}
} // namespace resumption_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..8070244bf2 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -35,26 +35,18 @@
#include "gtest/gtest.h"
#include "application_manager/usage_statistics.h"
-#include "include/application_mock.h"
-#include "include/resumption_data_mock.h"
-
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/resumption_data_mock.h"
+#include "utils/custom_string.h"
#include "application_manager/application.h"
#include "utils/data_accessor.h"
#include "application_manager/message_helper.h"
-#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;
-}
+#include "application_manager/resumption_data_test.h"
namespace test {
namespace components {
namespace resumption_test {
-
+namespace custom_str = utils::custom_string;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::ReturnPointee;
@@ -66,8 +58,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());
@@ -83,7 +76,7 @@ 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) {
+ for (uint32_t i = 0; i < kCountOfCommands_; ++i) {
EXPECT_EQ(i, res_list[i][am::strings::cmd_id].asUInt());
std::string name =
(*test_commands_map[i])[am::strings::menu_params]
@@ -118,7 +111,7 @@ void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
icon_type,
res_list[i][am::strings::cmd_icon][am::strings::image_type].asInt());
- for (uint32_t j = 0; j < count_of_choice; ++j) {
+ for (uint32_t j = 0; j < kCountOfChoice_; ++j) {
std::string vr =
(*test_commands_map[i])[am::strings::vr_commands][j].asString();
EXPECT_EQ(vr, res_list[i][am::strings::vr_commands][j].asString());
@@ -127,7 +120,7 @@ void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
}
void ResumptionDataTest::CheckSubmenues(sm::SmartObject& res_list) {
- for (uint32_t i = 0; i < count_of_submenues; ++i) {
+ for (uint32_t i = 0; i < kCountOfSubmenues_; ++i) {
uint32_t test_id =
(*test_submenu_map[i + 10])[am::strings::menu_id].asUInt();
std::string name =
@@ -215,7 +208,7 @@ void ResumptionDataTest::CheckChoiceSet(sm::SmartObject& res_list) {
void ResumptionDataTest::CheckAppFiles(sm::SmartObject& res_list) {
am::AppFile check_file;
- for (uint i = 0; i < count_of_files; ++i) {
+ for (uint i = 0; i < kCountOfFiles_; ++i) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
check_file = app_files_map_["test_file " + std::string(numb)];
@@ -261,13 +254,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 +278,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,15 +298,16 @@ 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()));
}
}
void ResumptionDataTest::CheckVRHelp(sm::SmartObject& res_list) {
std::string text;
int position;
- for (uint i = 0; i < count_of_vrhelptitle; ++i) {
+ for (uint i = 0; i < kCountOfVrhelptitle_; ++i) {
text = (*vr_help_)[i][am::strings::text].asString();
EXPECT_EQ(text, res_list[i][am::strings::text].asString());
position = (*vr_help_)[i][am::strings::position].asInt();
@@ -342,6 +339,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(kMacAddress_));
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 +377,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;
@@ -415,7 +414,7 @@ void ResumptionDataTest::SetVRHelpTitle() {
vr_help_title = "vr help title";
sm::SmartObject vr_help;
- for (uint i = 0; i < count_of_vrhelptitle; ++i) {
+ for (uint i = 0; i < kCountOfVrhelptitle_; ++i) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
vr_help[i][am::strings::text] = "vr help " + std::string(numb);
@@ -431,7 +430,7 @@ void ResumptionDataTest::SetCommands() {
sm::SmartObject vr_commandsvector;
sm::SmartObject sm_icon;
- for (uint32_t i = 0; i < count_of_commands; ++i) {
+ for (uint32_t i = 0; i < kCountOfCommands_; ++i) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
sm_comm[am::strings::cmd_id] = i;
@@ -440,7 +439,7 @@ void ResumptionDataTest::SetCommands() {
sm_comm[am::strings::menu_params][am::strings::menu_name] =
"Command" + std::string(numb);
- for (uint32_t j = 0; j < count_of_choice; ++j) {
+ for (uint32_t j = 0; j < kCountOfChoice_; ++j) {
char vr[12];
std::snprintf(vr, 12, "%d", i + j);
vr_commandsvector[j] = "VrCommand " + std::string(vr);
@@ -458,7 +457,7 @@ void ResumptionDataTest::SetCommands() {
void ResumptionDataTest::SetSubmenues() {
sm::SmartObject sm_comm;
- for (uint32_t i = 10; i < count_of_submenues + 10; ++i) {
+ for (uint32_t i = 10; i < kCountOfSubmenues_ + 10; ++i) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
sm_comm[am::strings::menu_id] = i;
@@ -476,8 +475,8 @@ void ResumptionDataTest::SetChoiceSet() {
sm::SmartObject sec_icon;
sm::SmartObject app_choice_set;
sm::SmartObject application_choice_sets;
- for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
- for (uint32_t j = 0; j < count_of_choice; ++j) {
+ for (uint32_t i = 0; i < kCountOfChoiceSets_; ++i) {
+ for (uint32_t j = 0; j < kCountOfChoice_; ++j) {
char numb[12];
std::snprintf(numb, 12, "%d", i + j);
@@ -513,7 +512,7 @@ void ResumptionDataTest::SetChoiceSet() {
void ResumptionDataTest::SetAppFiles() {
am::AppFile test_file;
int file_types;
- for (uint i = 0; i < count_of_files; ++i) {
+ for (uint i = 0; i < kCountOfFiles_; ++i) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
file_types = i;
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..08fa0a3eb5
--- /dev/null
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -0,0 +1,3090 @@
+/*
+ * 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 "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_query.h"
+#include "utils/file_system.h"
+#include "application_manager/resumption/resumption_sql_queries.h"
+#include "policy/sql_pt_queries.h"
+
+namespace test {
+namespace components {
+namespace resumption_test {
+
+using namespace ::resumption;
+
+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(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() OVERRIDE {
+ 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("subscribedForWayPoints");
+ 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(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, 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 resumption_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
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..50dd931309 100644
--- a/src/components/application_manager/test/state_controller/CMakeLists.txt
+++ b/src/components/application_manager/test/state_controller/CMakeLists.txt
@@ -30,20 +30,20 @@
if(BUILD_TESTS)
-set(appMain_DIR ${CMAKE_SOURCE_DIR}/src/appMain)
-
include_directories(
${GMOCK_INCLUDE_DIRECTORY}
- ${COMPONENTS_DIR}/application_manager/test/state_controller/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/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index 488d12b502..f19a0896d1 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,21 +30,35 @@
* 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/state_controller_impl.h"
#include "application_manager/usage_statistics.h"
-#include "application_manager_mock.h"
-#include "application_mock.h"
-#include "statistics_manager_mock.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/mock_application.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "transport_manager/mock_transport_manager.h"
+#include "application_manager/statistics_manager_mock.h"
#include "utils/lock.h"
#include "utils/data_accessor.h"
#include "utils/make_shared.h"
#include "application_manager/message_helper.h"
#include "application_manager/event_engine/event.h"
#include "application_manager/smart_object_keys.h"
+#include "application_manager/mock_message_helper.h"
+#include "policy/mock_policy_settings.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/mock_application_manager.h"
namespace am = application_manager;
+using am::HmiState;
+using am::HmiStatePtr;
+using am::UsageStatistics;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -53,30 +67,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 +84,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 +103,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,53 +117,66 @@ struct HmiStatesIDComparator {
#define NAVI true
#define NOT_NAVI false
-class StateControllerTest : public ::testing::Test {
+enum ApplicationType {
+ APP_TYPE_NON_MEDIA,
+ APP_TYPE_NAVI,
+ APP_TYPE_MEDIA,
+ APP_TYPE_ATTENUATED
+};
+
+class StateControllerImplTest : 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_;
+ StateControllerImplTest()
+ : ::testing::Test()
+ , usage_stat("0",
+ utils::SharedPtr<usage_statistics::StatisticsManager>(
+
+ new state_controller_test::MockStatisticsManager))
+ , applications_(application_set_, applications_lock_) {}
+ NiceMock<application_manager_test::MockApplicationManager> app_manager_mock_;
+ NiceMock<policy_test::MockPolicyHandlerInterface> policy_interface_;
+ NiceMock<connection_handler_test::MockConnectionHandler>
+ mock_connection_handler_;
+ NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_;
am::UsageStatistics usage_stat;
+ NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
am::ApplicationSet application_set_;
mutable sync_primitives::Lock applications_lock_;
DataAccessor<am::ApplicationSet> applications_;
- am::StateController state_ctrl_;
+ utils::SharedPtr<am::StateControllerImpl> state_ctrl_;
am::ApplicationSharedPtr simple_app_;
- NiceMock<ApplicationMock>* simple_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* simple_app_ptr_;
uint32_t simple_app_id_ = 1721;
am::ApplicationSharedPtr navi_app_;
- NiceMock<ApplicationMock>* navi_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* navi_app_ptr_;
uint32_t navi_app_id_ = 1762;
am::ApplicationSharedPtr media_app_;
- NiceMock<ApplicationMock>* media_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* media_app_ptr_;
uint32_t media_app_id_ = 1801;
am::ApplicationSharedPtr vc_app_;
- NiceMock<ApplicationMock>* vc_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* vc_app_ptr_;
uint32_t vc_app_id_ = 1825;
am::ApplicationSharedPtr media_navi_app_;
- NiceMock<ApplicationMock>* media_navi_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* media_navi_app_ptr_;
uint32_t media_navi_app_id_ = 1855;
am::ApplicationSharedPtr media_vc_app_;
- NiceMock<ApplicationMock>* media_vc_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* media_vc_app_ptr_;
uint32_t media_vc_app_id_ = 1881;
am::ApplicationSharedPtr navi_vc_app_;
- NiceMock<ApplicationMock>* navi_vc_app_ptr_;
+ NiceMock<application_manager_test::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<application_manager_test::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 +185,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,
@@ -187,18 +201,382 @@ class StateControllerTest : public ::testing::Test {
namespace SystemContext = mobile_apis::SystemContext;
am::HmiStatePtr state =
- utils::MakeShared<am::HmiState>(simple_app_id_, &app_manager_mock_);
+ utils::MakeShared<am::HmiState>(simple_app_id_, app_manager_mock_);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(aidio_ss);
state->set_system_context(system_context);
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 (StateControllerImplTest::*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 (StateControllerImplTest::*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 (StateControllerImplTest::*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,
- bool vc) {
- *app_mock = new NiceMock<ApplicationMock>;
+ am::ApplicationSharedPtr ConfigureApp(
+ NiceMock<application_manager_test::MockApplication>** app_mock,
+ uint32_t app_id,
+ bool media,
+ bool navi,
+ bool vc) {
+ *app_mock = new NiceMock<application_manager_test::MockApplication>;
Mock::AllowLeak(*app_mock); // WorkAround for gogletest bug
am::ApplicationSharedPtr app(*app_mock);
@@ -222,114 +600,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,
SystemContext::SYSCTXT_MAIN));
common_invalid_states_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::INVALID_ENUM,
+ 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::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::INVALID_ENUM,
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::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 +751,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,20 +831,55 @@ 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_, event_dispatcher())
+ .WillByDefault(ReturnRef(mock_event_dispatcher_));
+ state_ctrl_ = utils::MakeShared<am::StateControllerImpl>(app_manager_mock_);
+
ON_CALL(app_manager_mock_, applications())
.WillByDefault(Return(applications_));
ConfigureApps();
CheckAppConfiguration();
FillStatesLists();
+ SetConnection();
+ }
+
+ void TearDown() OVERRIDE {
+ delete conn_handler;
}
- void TearDown() { delete message_helper_mock_; }
+ void SetConnection() {
+ conn_handler = new connection_handler::ConnectionHandlerImpl(
+ mock_connection_handler__settings, mock_transport_manager);
+ ON_CALL(app_manager_mock_, connection_handler())
+ .WillByDefault(ReturnRef(*conn_handler));
+ }
+
+ void SetBCActivateAppRequestToHMI(
+ const hmi_apis::Common_HMILevel::eType hmi_lvl, uint32_t corr_id) {
+ ON_CALL(mock_connection_handler_, get_session_observer())
+ .WillByDefault(ReturnRef(mock_session_observer_));
+ ON_CALL(app_manager_mock_, connection_handler())
+ .WillByDefault(ReturnRef(mock_connection_handler_));
+ ON_CALL(app_manager_mock_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(policy_interface_));
+ smart_objects::SmartObjectSPtr bc_activate_app_request =
+ new smart_objects::SmartObject();
+ (*bc_activate_app_request)[am::strings::params]
+ [am::strings::correlation_id] = corr_id;
+ ON_CALL(*message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, hmi_lvl, _, _))
+ .WillByDefault(Return(bc_activate_app_request));
+
+ ON_CALL(app_manager_mock_, ManageHMICommand(bc_activate_app_request))
+ .WillByDefault(Return(true));
+ }
- void ExpectSuccesfullSetHmiState(am::ApplicationSharedPtr app,
- NiceMock<ApplicationMock>* app_mock,
- am::HmiStatePtr old_state,
- am::HmiStatePtr new_state) {
+ void ExpectSuccesfullSetHmiState(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr old_state,
+ am::HmiStatePtr new_state) {
EXPECT_CALL(*app_mock, CurrentHmiState())
.WillOnce(Return(old_state))
.WillOnce(Return(new_state));
@@ -434,15 +887,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<application_manager_test::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 +906,8 @@ class StateControllerTest : public ::testing::Test {
}
void ExpectAppWontChangeHmiStateDueToConflictResolving(
- am::ApplicationSharedPtr app, NiceMock<ApplicationMock>* app_mock,
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::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 +952,7 @@ class StateControllerTest : public ::testing::Test {
}
void CheckStateApplyingForApplication(
- NiceMock<ApplicationMock>& application,
+ NiceMock<application_manager_test::MockApplication>& application,
std::vector<am::HmiState::StateID>& state_ids) {
using smart_objects::SmartObject;
using am::event_engine::Event;
@@ -507,39 +964,43 @@ 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: {
Event vr_start_event(FunctionID::VR_Started);
- state_ctrl_.on_event(vr_start_event);
+ state_ctrl_->on_event(vr_start_event);
break;
}
case am::HmiState::StateID::STATE_ID_TTS_SESSION: {
Event tts_start_event(FunctionID::TTS_Started);
- state_ctrl_.on_event(tts_start_event);
+ state_ctrl_->on_event(tts_start_event);
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);
+ 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);
+ state_ctrl_->on_event(emergency_event);
break;
}
case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: {
- state_ctrl_.OnNaviStreamingStarted();
+ state_ctrl_->OnNaviStreamingStarted();
break;
}
default:
@@ -553,37 +1014,45 @@ 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);
- state_ctrl_.on_event(vr_stop_event);
+ state_ctrl_->on_event(vr_stop_event);
break;
}
case am::HmiState::StateID::STATE_ID_TTS_SESSION: {
Event tts_stop_event(FunctionID::TTS_Stopped);
- state_ctrl_.on_event(tts_stop_event);
+ state_ctrl_->on_event(tts_stop_event);
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);
+ 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);
+ state_ctrl_->on_event(emergency_event);
break;
}
case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: {
- state_ctrl_.OnNaviStreamingStopped();
+ state_ctrl_->OnNaviStreamingStopped();
break;
}
default:
@@ -595,37 +1064,38 @@ class StateControllerTest : public ::testing::Test {
}
};
-TEST_F(StateControllerTest, OnStateChangedWithEqualStates) {
+TEST_F(StateControllerImplTest, OnStateChangedWithEqualStates) {
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
for (uint32_t i = 0; i < valid_states_for_not_audio_app_.size(); ++i) {
- state_ctrl_.OnStateChanged(simple_app_,
- valid_states_for_not_audio_app_[i],
- valid_states_for_not_audio_app_[i]);
+ state_ctrl_->OnStateChanged(simple_app_,
+ valid_states_for_not_audio_app_[i],
+ valid_states_for_not_audio_app_[i]);
}
}
-TEST_F(StateControllerTest, OnStateChangedWithDifferentStates) {
+TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
for (uint32_t i = 0; i < valid_states_for_not_audio_app_.size(); ++i) {
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);
}
- state_ctrl_.OnStateChanged(simple_app_,
- valid_states_for_not_audio_app_[i],
- valid_states_for_not_audio_app_[j]);
+ state_ctrl_->OnStateChanged(simple_app_,
+ valid_states_for_not_audio_app_[i],
+ valid_states_for_not_audio_app_[j]);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
@@ -635,7 +1105,7 @@ TEST_F(StateControllerTest, OnStateChangedWithDifferentStates) {
}
}
-TEST_F(StateControllerTest, OnStateChangedToNone) {
+TEST_F(StateControllerImplTest, OnStateChangedToNone) {
using namespace am;
using namespace mobile_apis;
@@ -647,249 +1117,168 @@ TEST_F(StateControllerTest, OnStateChangedToNone) {
SystemContext::SYSCTXT_MAIN);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- state_ctrl_.OnStateChanged(simple_app_, none_state, not_none_state);
+ state_ctrl_->OnStateChanged(simple_app_, none_state, not_none_state);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
- state_ctrl_.OnStateChanged(simple_app_, not_none_state, none_state);
+ state_ctrl_->OnStateChanged(simple_app_, not_none_state, none_state);
}
-TEST_F(StateControllerTest, MoveSimpleAppToValidStates) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
+TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
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_,
SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_.SetRegularState<false>(simple_app_, state_to_setup);
+ state_ctrl_->SetRegularState(simple_app_, state_to_setup, false);
initial_state = state_to_setup;
}
}
-TEST_F(StateControllerTest, MoveAudioAppAppToValidStates) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
+TEST_F(StateControllerImplTest, 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<application_manager_test::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))));
- state_ctrl_.SetRegularState<false>(media_navi_vc_app_, state_to_setup);
+ state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
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(StateControllerImplTest, 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<application_manager_test::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(media_navi_vc_app_, state_to_setup, false);
+ initial_state = state_to_setup;
}
}
-TEST_F(StateControllerTest, MoveAppFromInValidStateToInvalid) {
+TEST_F(StateControllerImplTest, 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(simple_app_, invalid_state, false);
}
- 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(media_navi_vc_app_, invalid_state, false);
}
}
-*/
-TEST_F(StateControllerTest, SetFullToSimpleAppWhileAnotherSimpleAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
+
+TEST_F(StateControllerImplTest,
+ SetFullToSimpleAppWhileAnotherSimpleAppIsInFull) {
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<application_manager_test::MockApplication>* app_in_full_mock;
am::ApplicationSharedPtr app_moved_to_full;
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
app_in_full =
ConfigureApp(&app_in_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -899,244 +1288,261 @@ 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());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullNotAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
}
-TEST_F(StateControllerTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
+TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
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<application_manager_test::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<application_manager_test::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());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullNotAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::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());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1796, MEDIA, NOT_NAVI, NOT_VC);
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());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NAVI, VC);
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());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::MockApplication>*
+ app_moved_to_limited_mock;
am::ApplicationSharedPtr app_moved_to_limited =
ConfigureApp(&app_moved_to_limited_mock, 1796, NOT_MEDIA, NOT_NAVI, VC);
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());
- state_ctrl_.SetRegularState<false>(app_moved_to_limited, LimitedState());
+ state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::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());
+ state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::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<application_manager_test::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());
- state_ctrl_.SetRegularState<false>(app_moved_to_limited, LimitedState());
+ state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
}
-TEST_F(StateControllerTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
+TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
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<application_manager_test::MockApplication>* app_moved_to_full_mock =
+ simple_app_ptr_;
am::ApplicationSharedPtr limited_app1 = media_app_;
- NiceMock<ApplicationMock>* limited_app1_mock = media_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* limited_app1_mock =
+ media_app_ptr_;
am::ApplicationSharedPtr limited_app2 = navi_vc_app_;
- NiceMock<ApplicationMock>* limited_app2_mock = navi_vc_app_ptr_;
+ NiceMock<application_manager_test::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());
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app2, limited_app2_mock, LimitedState());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullNotAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::MockApplication>* app_moved_to_full_mock =
+ simple_app_ptr_;
am::ApplicationSharedPtr limited_app = media_app_;
- NiceMock<ApplicationMock>* limited_app_mock = media_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* limited_app_mock =
+ media_app_ptr_;
am::ApplicationSharedPtr full_app = navi_vc_app_;
- NiceMock<ApplicationMock>* full_app_mock = navi_vc_app_ptr_;
+ NiceMock<application_manager_test::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());
@@ -1144,25 +1550,24 @@ TEST_F(StateControllerTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullNotAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
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<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
am::ApplicationSharedPtr limited_app = media_app_;
- NiceMock<ApplicationMock>* limited_app_mock = media_app_ptr_;
+ NiceMock<application_manager_test::MockApplication>* limited_app_mock =
+ media_app_ptr_;
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -1170,8 +1575,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());
@@ -1179,27 +1586,25 @@ TEST_F(StateControllerTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullNotAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
}
TEST_F(
- StateControllerTest,
+ StateControllerImplTest,
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<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* limited_app_mock;
+ NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -1207,8 +1612,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());
@@ -1216,27 +1623,25 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
}
TEST_F(
- StateControllerTest,
+ StateControllerImplTest,
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<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* limited_app_mock;
+ NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NAVI, NOT_VC);
@@ -1244,8 +1649,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());
@@ -1253,13 +1660,11 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_.SetRegularState<false>(app_moved_to_full, FullAudibleState());
+ state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
SetFullToAudioAppWhile3AudioAppsWithSameTypeInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -1268,21 +1673,21 @@ 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(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, LimitedState(), BackgroundState());
- state_ctrl_.SetRegularState<false>(media_navi_vc_app_, FullAudibleState());
+ state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
}
-TEST_F(StateControllerTest,
+TEST_F(StateControllerImplTest,
SetFullToAudioAppWhile2AudioAppsWithSameTypeInLimitedAndOneInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -1291,18 +1696,21 @@ 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(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, FullAudibleState(), BackgroundState());
- state_ctrl_.SetRegularState<false>(media_navi_vc_app_, FullAudibleState());
+ state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
}
-TEST_F(StateControllerTest, ActivateAppSuccessReceivedFromHMI) {
+// TODO {AKozoriz} Changed logic in state_controller
+TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
using namespace hmi_apis;
using namespace mobile_apis;
@@ -1318,45 +1726,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);
- }
+ SetBCActivateAppRequestToHMI(hmi_level, corr_id);
+ ON_CALL(app_manager_mock_, ManageHMICommand(bc_activate_app_request))
+ .WillByDefault(Return(true));
+
+ 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(media_app_, hmi_state, true);
+ 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,45 +1794,45 @@ 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(StateControllerImplTest, 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;
am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(message);
- state_ctrl_.on_event(event);
+ state_ctrl_->on_event(event);
}
}
-*/
-TEST_F(StateControllerTest, ActivateAppInvalidCorrelationId) {
+
+TEST_F(StateControllerImplTest, 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,53 +1842,642 @@ TEST_F(StateControllerTest, ActivateAppInvalidCorrelationId) {
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(simple_app_->app_id(), _, _))
.Times(0);
- state_ctrl_.SetRegularState<true>(simple_app_, FullNotAudibleState());
+ SetBCActivateAppRequestToHMI(Common_HMILevel::FULL, corr_id);
+ state_ctrl_->SetRegularState(simple_app_, FullNotAudibleState(), true);
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(FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(message);
- state_ctrl_.on_event(event);
+ state_ctrl_->on_event(event);
}
-/*
-TEST_F(StateControllerTest, ApplyTempStatesForSimpleApp) {
+
+TEST_F(StateControllerImplTest, ApplyTempStatesForSimpleApp) {
InsertApplication(simple_app_);
CheckStateApplyingForApplication(*simple_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForMediaApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaApp) {
InsertApplication(media_app_);
CheckStateApplyingForApplication(*media_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForNaviApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForNaviApp) {
InsertApplication(navi_app_);
CheckStateApplyingForApplication(*navi_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForVCApp) {
InsertApplication(vc_app_);
CheckStateApplyingForApplication(*vc_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForMediaNaviApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviApp) {
InsertApplication(media_navi_app_);
CheckStateApplyingForApplication(*media_navi_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForMediaVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaVCApp) {
InsertApplication(media_vc_app_);
CheckStateApplyingForApplication(*media_vc_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForNaviVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForNaviVCApp) {
InsertApplication(navi_vc_app_);
CheckStateApplyingForApplication(*navi_vc_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerTest, ApplyTempStatesForMediaNaviVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviVCApp) {
InsertApplication(media_navi_vc_app_);
CheckStateApplyingForApplication(*media_navi_vc_app_ptr_, valid_state_ids_);
}
-*/
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) {
+ am::HmiStatePtr state_vr =
+ utils::MakeShared<am::VRHmiState>(simple_app_id_, app_manager_mock_);
+ TestSetState(simple_app_,
+ state_vr,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) {
+ am::HmiStatePtr state_vr =
+ utils::MakeShared<am::VRHmiState>(media_app_id_, app_manager_mock_);
+ TestSetState(media_app_,
+ state_vr,
+ APP_TYPE_MEDIA,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ 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,
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixVRWithPhoneCall) {
+ TestMixState<am::PhoneCallHmiState, am::VRHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixTTSWithPhoneCallAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::PhoneCallHmiState, am::TTSHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixTTSWithPhoneCallAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::PhoneCallHmiState, am::TTSHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ MixNaviStreamingWithPhoneCallAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::PhoneCallHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ MixNaviStreamingWithPhoneCallAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::PhoneCallHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixSafetyModeWithPhoneCall) {
+ TestMixState<am::PhoneCallHmiState, am::SafetyModeHmiState>(
+ &StateControllerImplTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixTTSWithVRAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::VRHmiState, am::TTSHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixTTSWithVRAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::VRHmiState, am::TTSHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixNaviStreamingWithVRAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::VRHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixNaviStreamingWithVRAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::VRHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixSafetyModeStreamingWithVR) {
+ TestMixState<am::VRHmiState, am::SafetyModeHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ MixNaviStreamingWithTTSAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::TTSHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixNaviStreamingWithTTSAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::TTSHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareNaviStreamTTSStateResult);
+}
+
+TEST_F(StateControllerImplTest, MixSafetyModeWithTTSAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::TTSHmiState, am::SafetyModeHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, MixSafetyModeWithTTSAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::TTSHmiState, am::SafetyModeHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ MixSafetyModeWithNaviStreamingAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::SafetyModeHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest,
+ MixSafetyModeWithNaviStreamingAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::SafetyModeHmiState, am::NaviStreamingHmiState>(
+ &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerImplTest, 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(
+ static_cast<hmi_apis::Common_HMILevel::eType>(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(StateControllerImplTest, 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(StateControllerImplTest,
+ 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(simple_app_, check_state, false);
+
+ 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(media_app_, check_state, false);
+}
+
+TEST_F(StateControllerImplTest, 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(simple_app_, check_state, false);
+
+ // 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(media_app_, check_state, false);
+}
+
+TEST_F(StateControllerImplTest,
+ 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(simple_app_, check_state, false);
+
+ // 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(media_app_, check_state, false);
+}
+
+TEST_F(StateControllerImplTest,
+ 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(media_app_, check_state, false);
+}
+
} // 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..b5d1da0992
--- /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 "policy/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..0f52639575
--- /dev/null
+++ b/src/components/application_manager/test/zero_request_amount_test.cc
@@ -0,0 +1,169 @@
+/*
+ * 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/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
+ 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
+ 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
+ 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