summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src
diff options
context:
space:
mode:
authorJustin Dickow <jjdickow@gmail.com>2015-02-20 09:11:18 -0500
committerJustin Dickow <jjdickow@gmail.com>2015-02-20 09:11:18 -0500
commita7c5d752cb75485baa0ded5226335d0f8eb10321 (patch)
treefbfd9251ada2cdcd5cf6a03a79887d08f6b496d7 /src/components/application_manager/src
parentb2b2233d866f102d3de339afa8ccaf37d3cf2570 (diff)
downloadsdl_core-a7c5d752cb75485baa0ded5226335d0f8eb10321.tar.gz
Bug Fixes and ImprovementsSynchronizationCommit
Fix Empty perform iteration request Fix type of name from string to enum SendLocation implemented on HTML5 HMI Fixed PI response on VR rejection due to high priority. Fix Apps not responsive/not able to start app/apps remain listed on SYNC even after USB disconnect Mobile API change and processing capabilities Change perform interaction request conditions. Fix SDL must always start 3sec timer before resuming the HMILevel of the app Remove redundant StartSavePersistentDataTimer() call. Change wrong predicate name to right. Added stream request handling feature Made streaming timeout in media manager configurable Put navi app in LIMITED in case of phone call Handling of audio state for applications Add stop streaming timeout into ini file Implement HMILevel resumption for job-1 Fix result code ABORTED when interrupts it by Voice recognition activation Fix incorrect value parameter unexpectedDisconnect in BCOnAppUnregistered Fix SDL send BC.OnAppUnregistered with "unexpectedDisconnect" set to "true" in case received from HMI OnExitAllApplications {"reason":"MASTER_RESET"} Fix Update ini file for iAP1 support Current working directory added to image path Fix helpers to make it workable with more then 2 parameters DCHECK() for ManageMobileCommand() replaced with log message because the latter returns false in some regular situations (e.g. TOO_MANY_PENDING_REQUESTS, see SDLAQ-CRS-10) Remove connection after closing. Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Diffstat (limited to 'src/components/application_manager/src')
-rw-r--r--src/components/application_manager/src/application_data_impl.cc82
-rw-r--r--src/components/application_manager/src/application_impl.cc83
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc1506
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc2
-rw-r--r--src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc74
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc54
-rw-r--r--src/components/application_manager/src/commands/hmi/activate_app_request.cc21
-rw-r--r--src/components/application_manager/src/commands/hmi/activate_app_response.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_app_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/allow_app_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/close_popup_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/close_popup_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/get_system_info_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/get_system_info_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/get_urls.cc53
-rw-r--r--src/components/application_manager/src/commands/hmi/get_urls_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_send_location_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_send_location_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/notification_from_hmi.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc47
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_button_event_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_button_press_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc51
-rw-r--r--src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_find_applications.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_policy_update.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_put_file_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ready_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_received_policy_update.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_record_start_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_status_update_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_context_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_error_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_request_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_update_device_list.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/request_from_hmi.cc22
-rw-r--r--src/components/application_manager/src/commands/hmi/request_to_hmi.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/response_from_hmi.cc5
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc54
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_policy_update.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_language_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_language_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_speak_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_speak_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_command_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_alert_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_alert_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_language_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_language_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc55
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc57
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_show_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_show_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_slider_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_slider_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/update_app_list_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/update_app_list_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/update_device_list_request.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/update_device_list_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/update_sdl_request.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/update_sdl_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc22
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_read_did_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_read_did_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_add_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_add_command_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_language_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_language_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc4
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc101
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc45
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc19
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc19
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_file_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_file_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc19
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/list_files_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/list_files_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_press_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/on_command_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc14
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc81
-rw-r--r--src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_language_change_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc302
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/put_file_request.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/put_file_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc184
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_response.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_request.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc66
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_request.cc235
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_response.cc56
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/show_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc14
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/system_request.cc24
-rw-r--r--src/components/application_manager/src/commands/mobile/system_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_response.cc2
-rw-r--r--src/components/application_manager/src/event_engine/event.cc2
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher.cc85
-rw-r--r--src/components/application_manager/src/hmi_capabilities.cc7
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc10
-rw-r--r--src/components/application_manager/src/message.cc2
-rw-r--r--src/components/application_manager/src/message_helper.cc715
-rw-r--r--src/components/application_manager/src/mobile_command_factory.cc15
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc34
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc25
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc830
-rw-r--r--src/components/application_manager/src/request_controller.cc577
-rw-r--r--src/components/application_manager/src/request_info.cc322
-rw-r--r--src/components/application_manager/src/resume_ctrl.cpp1495
-rw-r--r--src/components/application_manager/src/usage_statistics.cc2
329 files changed, 5294 insertions, 3344 deletions
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index 56fc88ffe3..ce143fab5c 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -30,15 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+
#include "application_manager/application_data_impl.h"
#include "application_manager/smart_object_keys.h"
+#include "utils/logger.h"
namespace application_manager {
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationDataImpl")
InitialApplicationDataImpl::InitialApplicationDataImpl()
: app_types_(NULL),
vr_synonyms_(NULL),
- mobile_app_id_(NULL),
tts_name_(NULL),
ngn_media_screen_name_(NULL),
language_(mobile_api::Language::INVALID_ENUM),
@@ -56,11 +59,6 @@ InitialApplicationDataImpl::~InitialApplicationDataImpl() {
vr_synonyms_ = NULL;
}
- if (mobile_app_id_) {
- delete mobile_app_id_;
- mobile_app_id_ = NULL;
- }
-
if (tts_name_) {
delete tts_name_;
tts_name_ = NULL;
@@ -82,8 +80,7 @@ InitialApplicationDataImpl::vr_synonyms() const {
return vr_synonyms_;
}
-const smart_objects::SmartObject*
-InitialApplicationDataImpl::mobile_app_id() const {
+std::string InitialApplicationDataImpl::mobile_app_id() const {
return mobile_app_id_;
}
@@ -124,11 +121,8 @@ void InitialApplicationDataImpl::set_vr_synonyms(
}
void InitialApplicationDataImpl::set_mobile_app_id(
- const smart_objects::SmartObject& mobile_app_id) {
- if (mobile_app_id_) {
- delete mobile_app_id_;
- }
- mobile_app_id_ = new smart_objects::SmartObject(mobile_app_id);
+ const std::string& mobile_app_id) {
+ mobile_app_id_ = mobile_app_id;
}
void InitialApplicationDataImpl::set_tts_name(
@@ -171,6 +165,7 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
menu_icon_(NULL),
tbt_show_command_(NULL),
commands_(),
+ commands_lock_(true),
sub_menu_(),
choice_set_map_(),
performinteraction_choice_set_map_(),
@@ -265,18 +260,42 @@ DynamicApplicationDataImpl::tbt_show_command() const {
return tbt_show_command_;
}
-const NsSmartDeviceLink::NsSmartObjects::SmartObject *DynamicApplicationDataImpl::keyboard_props() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::keyboard_props() const {
return keyboard_props_;
}
-const NsSmartDeviceLink::NsSmartObjects::SmartObject *DynamicApplicationDataImpl::menu_title() const {
+const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_title() const {
return menu_title_;
}
-const NsSmartDeviceLink::NsSmartObjects::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);
+
+ SetGlobalProperties(properties_so.getElement(strings::vr_help),
+ &DynamicApplicationData::set_vr_help);
+
+ SetGlobalProperties(properties_so.getElement(strings::timeout_prompt),
+ &DynamicApplicationData::set_timeout_prompt);
+
+ SetGlobalProperties(properties_so.getElement(strings::help_prompt),
+ &DynamicApplicationData::set_help_prompt);
+
+ SetGlobalProperties(properties_so.getElement(strings::keyboard_properties),
+ &DynamicApplicationData::set_keyboard_props);
+
+ SetGlobalProperties(properties_so.getElement(strings::menu_title),
+ &DynamicApplicationData::set_menu_title);
+
+ SetGlobalProperties(properties_so.getElement(strings::menu_icon),
+ &DynamicApplicationData::set_menu_icon);
+}
+
void DynamicApplicationDataImpl::set_help_prompt(
const smart_objects::SmartObject& help_prompt) {
if (help_prompt_) {
@@ -368,15 +387,31 @@ void DynamicApplicationDataImpl::set_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&)) {
+
+ smart_objects::SmartType so_type = param.getType();
+ if (so_type != smart_objects::SmartType::SmartType_Invalid &&
+ so_type != smart_objects::SmartType::SmartType_Null) {
+ if (callback) {
+ (this->*callback)(param);
+ }
+ } else {
+ LOG4CXX_WARN(logger_, "Invalid or Null smart object");
+ }
+}
void DynamicApplicationDataImpl::AddCommand(
uint32_t cmd_id, const smart_objects::SmartObject& command) {
+ sync_primitives::AutoLock lock(commands_lock_);
commands_[cmd_id] = new smart_objects::SmartObject(command);
}
void DynamicApplicationDataImpl::RemoveCommand(uint32_t cmd_id) {
+ sync_primitives::AutoLock lock(commands_lock_);
CommandsMap::iterator it = commands_.find(cmd_id);
-
if (commands_.end() != it) {
delete it->second;
commands_.erase(it);
@@ -385,6 +420,7 @@ void DynamicApplicationDataImpl::RemoveCommand(uint32_t cmd_id) {
smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand(
uint32_t cmd_id) {
+ sync_primitives::AutoLock lock(commands_lock_);
CommandsMap::const_iterator it = commands_.find(cmd_id);
if (it != commands_.end()) {
return it->second;
@@ -396,10 +432,12 @@ 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) {
+ sync_primitives::AutoLock lock(sub_menu_lock_);
sub_menu_[menu_id] = new smart_objects::SmartObject(menu);
}
void DynamicApplicationDataImpl::RemoveSubMenu(uint32_t menu_id) {
+ sync_primitives::AutoLock lock(sub_menu_lock_);
SubMenuMap::iterator it = sub_menu_.find(menu_id);
if (sub_menu_.end() != it) {
@@ -410,6 +448,7 @@ void DynamicApplicationDataImpl::RemoveSubMenu(uint32_t menu_id) {
smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu(
uint32_t menu_id) const {
+ sync_primitives::AutoLock lock(sub_menu_lock_);
SubMenuMap::const_iterator it = sub_menu_.find(menu_id);
if (it != sub_menu_.end()) {
return it->second;
@@ -420,6 +459,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;
++it) {
@@ -433,10 +473,12 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
void DynamicApplicationDataImpl::AddChoiceSet(
uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
+ sync_primitives::AutoLock lock(choice_set_map_lock_);
choice_set_map_[choice_set_id] = new smart_objects::SmartObject(choice_set);
}
void DynamicApplicationDataImpl::RemoveChoiceSet(uint32_t choice_set_id) {
+ sync_primitives::AutoLock lock(choice_set_map_lock_);
ChoiceSetMap::iterator it = choice_set_map_.find(choice_set_id);
if (choice_set_map_.end() != it) {
@@ -447,6 +489,7 @@ void DynamicApplicationDataImpl::RemoveChoiceSet(uint32_t choice_set_id) {
smart_objects::SmartObject* DynamicApplicationDataImpl::FindChoiceSet(
uint32_t choice_set_id) {
+ sync_primitives::AutoLock lock(choice_set_map_lock_);
ChoiceSetMap::const_iterator it = choice_set_map_.find(choice_set_id);
if (it != choice_set_map_.end()) {
return it->second;
@@ -457,11 +500,13 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindChoiceSet(
void DynamicApplicationDataImpl::AddPerformInteractionChoiceSet(
uint32_t choice_set_id, const smart_objects::SmartObject& vr_commands) {
+ sync_primitives::AutoLock lock(performinteraction_choice_set_lock_);
performinteraction_choice_set_map_[choice_set_id] =
new smart_objects::SmartObject(vr_commands);
}
void DynamicApplicationDataImpl::DeletePerformInteractionChoiceSetMap() {
+ sync_primitives::AutoLock lock(performinteraction_choice_set_lock_);
PerformChoiceSetMap::iterator it = performinteraction_choice_set_map_.begin();
for (; performinteraction_choice_set_map_.end() != it; ++it) {
delete it->second;
@@ -472,6 +517,7 @@ void DynamicApplicationDataImpl::DeletePerformInteractionChoiceSetMap() {
smart_objects::SmartObject*
DynamicApplicationDataImpl::FindPerformInteractionChoiceSet(
uint32_t choice_set_id) const {
+ sync_primitives::AutoLock lock(performinteraction_choice_set_lock_);
PerformChoiceSetMap::const_iterator it = performinteraction_choice_set_map_
.find(choice_set_id);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index f52467f751..aba0563ad1 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) 2013, Ford Motor Company
+/*
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,13 +32,14 @@
#include <string>
#include <strings.h>
-#include <stdlib.h>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "application_manager/application_manager_impl.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"
namespace {
@@ -82,7 +83,7 @@ ApplicationImpl::ApplicationImpl(uint32_t application_id,
app_id_(application_id),
active_message_(NULL),
is_media_(false),
- allowed_support_navigation_(false),
+ is_navi_(false),
hmi_supports_navi_video_streaming_(false),
hmi_supports_navi_audio_streaming_(false),
is_app_allowed_(true),
@@ -111,9 +112,10 @@ ApplicationImpl::ApplicationImpl(uint32_t application_id,
{date_time::DateTime::getCurrentTime(), 0};
- set_mobile_app_id(smart_objects::SmartObject(mobile_app_id));
+ set_mobile_app_id(mobile_app_id);
set_name(app_name);
+ MarkUnregistered();
// subscribe application to custom button by default
SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON);
@@ -147,16 +149,24 @@ bool ApplicationImpl::IsFullscreen() const {
return mobile_api::HMILevel::HMI_FULL == hmi_level_;
}
-bool ApplicationImpl::MakeFullscreen() {
- hmi_level_ = mobile_api::HMILevel::HMI_FULL;
- if (is_media_ && !tts_speak_state_) {
- audio_streaming_state_ = mobile_api::AudioStreamingState::AUDIBLE;
- }
- system_context_ = mobile_api::SystemContext::SYSCTXT_MAIN;
- if (!has_been_activated_) {
- has_been_activated_ = true;
+void ApplicationImpl::ChangeSupportingAppHMIType() {
+ is_navi_ = false;
+ is_voice_communication_application_ = false;
+ const smart_objects::SmartObject& array_app_types = *app_types_;
+ uint32_t lenght_app_types = array_app_types.length();
+
+ for (uint32_t i = 0; i < lenght_app_types; ++i) {
+ if (mobile_apis::AppHMIType::NAVIGATION ==
+ static_cast<mobile_apis::AppHMIType::eType>(
+ array_app_types[i].asUInt())) {
+ is_navi_ = true;
+ }
+ if (mobile_apis::AppHMIType::COMMUNICATION ==
+ static_cast<mobile_apis::AppHMIType::eType>(
+ array_app_types[i].asUInt())) {
+ is_voice_communication_application_ = true;
+ }
}
- return true;
}
bool ApplicationImpl::IsAudible() const {
@@ -164,17 +174,8 @@ bool ApplicationImpl::IsAudible() const {
|| mobile_api::HMILevel::HMI_LIMITED == hmi_level_;
}
-void ApplicationImpl::MakeNotAudible() {
- hmi_level_ = mobile_api::HMILevel::HMI_BACKGROUND;
- audio_streaming_state_ = mobile_api::AudioStreamingState::NOT_AUDIBLE;
-}
-
-bool ApplicationImpl::allowed_support_navigation() const {
- return allowed_support_navigation_;
-}
-
-void ApplicationImpl::set_allowed_support_navigation(bool allow) {
- allowed_support_navigation_ = allow;
+void ApplicationImpl::set_is_navi(bool allow) {
+ is_navi_ = allow;
}
bool ApplicationImpl::is_voice_communication_supported() const {
@@ -189,7 +190,7 @@ void ApplicationImpl::set_voice_communication_supported(
bool ApplicationImpl::IsAudioApplication() const {
return is_media_ ||
is_voice_communication_application_ ||
- allowed_support_navigation_;
+ is_navi_;
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -209,7 +210,7 @@ const std::string& ApplicationImpl::name() const {
}
const std::string ApplicationImpl::folder_name() const {
- return name() + mobile_app_id()->asString();
+ return name() + mobile_app_id();
}
bool ApplicationImpl::is_media_application() const {
@@ -295,7 +296,7 @@ void ApplicationImpl::set_hmi_level(
delete_file_in_none_count_ = 0;
list_files_in_none_count_ = 0;
}
-
+ LOG4CXX_INFO(logger_, "hmi_level = " << hmi_level);
hmi_level_ = hmi_level;
usage_report_.RecordHmiStateChanged(hmi_level);
}
@@ -372,7 +373,7 @@ void ApplicationImpl::OnVideoStreamRetry() {
video_stream_retry_timer_->updateTimeOut(time_out);
} else {
LOG4CXX_INFO(logger_, "Stop video streaming retry");
- video_stream_retry_timer_.release();
+ video_stream_retry_timer_->stop();
set_video_stream_retry_active(false);
}
}
@@ -391,7 +392,7 @@ void ApplicationImpl::OnAudioStreamRetry() {
audio_stream_retry_timer_->updateTimeOut(time_out);
} else {
LOG4CXX_INFO(logger_, "Stop audio streaming retry");
- audio_stream_retry_timer_.release();
+ audio_stream_retry_timer_->stop();
set_audio_stream_retry_active(false);
}
}
@@ -415,7 +416,7 @@ void ApplicationImpl::set_system_context(
void ApplicationImpl::set_audio_streaming_state(
const mobile_api::AudioStreamingState::eType& state) {
- if (!is_media_application()
+ if (!(is_media_application() || is_navi())
&& state != mobile_api::AudioStreamingState::NOT_AUDIBLE) {
LOG4CXX_WARN(logger_, "Trying to set audio streaming state"
" for non-media application to different from NOT_AUDIBLE");
@@ -452,6 +453,11 @@ bool ApplicationImpl::has_been_activated() const {
return has_been_activated_;
}
+bool ApplicationImpl::set_activated(bool is_active) {
+ has_been_activated_ = is_active;
+ return true;
+}
+
void ApplicationImpl::set_protocol_version(
const ProtocolVersion& protocol_version) {
protocol_version_ = protocol_version;
@@ -599,7 +605,7 @@ bool ApplicationImpl::IsCommandLimitsExceeded(
// 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_->asString());
+ mobile_app_id_);
if (0 == cmd_limit) {
return true;
@@ -646,19 +652,14 @@ const std::set<uint32_t>& ApplicationImpl::SubscribesIVI() const {
return subscribed_vehicle_info_;
}
-uint32_t ApplicationImpl::nextHash() {
- hash_val_ = rand();
- return hash_val_;
-}
-
-uint32_t ApplicationImpl::curHash() const {
+const std::string& ApplicationImpl::curHash() const {
return hash_val_;
}
-uint32_t ApplicationImpl::UpdateHash() {
- uint32_t new_hash= nextHash();
+void ApplicationImpl::UpdateHash() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hash_val_ = utils::gen_hash(profile::Profile::instance()->hash_string_size());
MessageHelper::SendHashUpdateNotification(app_id());
- return new_hash;
}
void ApplicationImpl::CleanupFiles() {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 6d7fdeec61..1c4a924c06 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -35,6 +35,7 @@
#include <climits>
#include <string>
#include <fstream>
+#include <utility>
#include "application_manager/application_manager_impl.h"
#include "application_manager/mobile_command_factory.h"
@@ -51,10 +52,19 @@
#include "config_profile/profile.h"
#include "utils/threads/thread.h"
#include "utils/file_system.h"
+#include "utils/helpers.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 <time.h>
+namespace {
+ int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
+ return std::rand() % to + from;
+ }
+}
+
namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -65,6 +75,8 @@ const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX;
namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings;
+using namespace NsSmartDeviceLink::NsSmartObjects;
+
ApplicationManagerImpl::ApplicationManagerImpl()
: applications_list_lock_(true),
audio_pass_thru_active_(false),
@@ -83,9 +95,12 @@ ApplicationManagerImpl::ApplicationManagerImpl()
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::IGNITION_OFF),
+ unregister_reason_(mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM),
resume_ctrl_(this),
+ end_services_timer("EndServiceTimer", this, &ApplicationManagerImpl::EndNaviServices),
+ wait_end_service_timeout_(profile::Profile::instance()->stop_streaming_timeout()),
#ifdef TIME_TESTER
metric_observer_(NULL),
#endif // TIME_TESTER
@@ -93,8 +108,10 @@ ApplicationManagerImpl::ApplicationManagerImpl()
tts_global_properties_timer_("TTSGLPRTimer",
this,
&ApplicationManagerImpl::OnTimerSendTTSGlobalProperties,
- true) {
+ true),
+ is_low_voltage_(false) {
std::srand(std::time(0));
+ AddPolicyObserver(this);
}
ApplicationManagerImpl::~ApplicationManagerImpl() {
@@ -104,17 +121,18 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
media_manager_ = NULL;
hmi_handler_ = NULL;
connection_handler_ = NULL;
- if (hmi_so_factory_) {
+ if(hmi_so_factory_) {
delete hmi_so_factory_;
+ hmi_so_factory_ = NULL;
}
- hmi_so_factory_ = NULL;
- if (mobile_so_factory_) {
+ if(mobile_so_factory_) {
delete mobile_so_factory_;
+ mobile_so_factory_ = NULL;
}
- mobile_so_factory_ = NULL;
protocol_handler_ = NULL;
media_manager_ = NULL;
LOG4CXX_INFO(logger_, "Destroying Policy Handler");
+ RemovePolicyObserver(this);
policy::PolicyHandler::destroy();
}
@@ -129,7 +147,7 @@ bool ApplicationManagerImpl::Stop() {
}
- // for PASA customer policy backup should happen OnExitAllApp(SUSPEND)
+ // for PASA customer policy backup should happen :AllApp(SUSPEND)
LOG4CXX_INFO(logger_, "Unloading policy library.");
policy::PolicyHandler::instance()->UnloadPolicyLibrary();
@@ -137,103 +155,123 @@ bool ApplicationManagerImpl::Stop() {
}
ApplicationSharedPtr ApplicationManagerImpl::application(uint32_t app_id) const {
- sync_primitives::AutoLock lock(applications_list_lock_);
-
- std::set<ApplicationSharedPtr>::const_iterator it =
- application_list_.begin();
- for (; it != application_list_.end(); ++it) {
- if ((*it)->app_id() == app_id) {
- return (*it);
- }
- }
- return ApplicationSharedPtr();
+ AppIdPredicate finder(app_id);
+ ApplicationListAccessor accessor;
+ ApplicationSharedPtr app = accessor.Find(finder);
+ LOG4CXX_DEBUG(logger_, " app_id << " << app_id << "Found = " << app);
+ return app;
}
ApplicationSharedPtr ApplicationManagerImpl::application_by_hmi_app(
uint32_t hmi_app_id) const {
- sync_primitives::AutoLock lock(applications_list_lock_);
-
- std::set<ApplicationSharedPtr>::const_iterator it =
- application_list_.begin();
- for (; it != application_list_.end(); ++it) {
- if ((*it)->hmi_app_id() == hmi_app_id) {
- return (*it);
- }
- }
- return ApplicationSharedPtr();
+ 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;
}
ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id(
const std::string& policy_app_id) const {
- sync_primitives::AutoLock lock(applications_list_lock_);
+ 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;
+}
- std::vector<ApplicationSharedPtr> result;
- for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- application_list_.end() != it;
- ++it) {
- if (policy_app_id.compare((*it)->mobile_app_id()->asString()) == 0) {
- return *it;
- }
- }
- return ApplicationSharedPtr();
+bool ActiveAppPredicate (const ApplicationSharedPtr app) {
+ return app ? app->IsFullscreen() : false;
}
ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
// TODO(DK) : check driver distraction
- for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- application_list_.end() != it;
- ++it) {
- if ((*it)->IsFullscreen()) {
- return *it;
- }
- }
- return ApplicationSharedPtr();
+ ApplicationListAccessor accessor;
+ ApplicationSharedPtr app = accessor.Find(ActiveAppPredicate);
+ LOG4CXX_DEBUG(logger_, " Found = " << app);
+ return app;
}
+bool LimitedAppPredicate (const ApplicationSharedPtr app) {
+ return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED :
+ false;
+}
ApplicationSharedPtr
ApplicationManagerImpl::get_limited_media_application() const {
- sync_primitives::AutoLock lock(applications_list_lock_);
-
- for (TAppListIt it = application_list_.begin();
- application_list_.end() != it; ++it) {
- if ((*it)->is_media_application() &&
- (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) {
- return *it;
- }
- }
+ ApplicationListAccessor accessor;
+ ApplicationSharedPtr app = accessor.Find(LimitedAppPredicate);
+ LOG4CXX_DEBUG(logger_, " Found = " << app);
+ return app;
+}
- return ApplicationSharedPtr();
+bool LimitedNaviAppPredicate (const ApplicationSharedPtr app) {
+ return app ? (app->is_navi() &&
+ app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) :
+ false;
}
ApplicationSharedPtr
ApplicationManagerImpl::get_limited_navi_application() const {
- sync_primitives::AutoLock lock(applications_list_lock_);
-
- for (TAppListIt it = application_list_.begin();
- application_list_.end() != it; ++it) {
- if ((*it)->allowed_support_navigation() &&
- (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) {
- return *it;
- }
- }
+ ApplicationListAccessor accessor;
+ ApplicationSharedPtr app = accessor.Find(LimitedNaviAppPredicate);
+ LOG4CXX_DEBUG(logger_, " Found = " << app);
+ return app;
+}
- return ApplicationSharedPtr();
+bool LimitedVoiceAppPredicate (const ApplicationSharedPtr app) {
+ return app ? (app->is_voice_communication_supported() &&
+ app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) :
+ false;
}
ApplicationSharedPtr
ApplicationManagerImpl::get_limited_voice_application() const {
- sync_primitives::AutoLock lock(applications_list_lock_);
+ ApplicationListAccessor accessor;
+ ApplicationSharedPtr app = accessor.Find(LimitedVoiceAppPredicate);
+ LOG4CXX_DEBUG(logger_, " Found = " << app);
+ return app;
+}
- for (TAppListIt it = application_list_.begin();
- application_list_.end() != it; ++it) {
- if ((*it)->is_voice_communication_supported() &&
- (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) {
- return *it;
- }
+bool NaviAppPredicate (const ApplicationSharedPtr app) {
+ return app ? app->is_navi() : false;
+}
+
+std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_with_navi() {
+ ApplicationListAccessor accessor;
+ std::vector<ApplicationSharedPtr> apps = accessor.FindAll(NaviAppPredicate);
+ LOG4CXX_DEBUG(logger_, " Found count: " << apps.size());
+ return apps;
+}
+std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button(
+ uint32_t button) {
+ 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;
+}
+
+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;
}
- return ApplicationSharedPtr();
+ SubscribedToIVIPredicate finder(
+ static_cast<int32_t>(vehicle_info));
+ ApplicationListAccessor accessor;
+ std::vector<ApplicationSharedPtr> apps = accessor.FindAll(NaviAppPredicate);
+ LOG4CXX_DEBUG(logger_, " vehicle_info << " << vehicle_info << "Found count: " << apps.size());
+ return apps;
}
bool ApplicationManagerImpl::DoesAudioAppWithSameHMITypeExistInFullOrLimited(
@@ -288,58 +326,13 @@ bool ApplicationManagerImpl::DoesAudioAppWithSameHMITypeExistInFullOrLimited(
return false;
}
-std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button(
- uint32_t button) {
- std::vector<ApplicationSharedPtr> result;
- for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- application_list_.end() != it; ++it) {
- if ((*it)->IsSubscribedToButton(
- static_cast<mobile_apis::ButtonName::eType>(button))) {
- result.push_back(*it);
- }
- }
- return result;
-}
-
-std::vector<utils::SharedPtr<Application>> 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;
- }
-
- std::vector<utils::SharedPtr<application_manager::Application>> result;
- for (std::set<utils::SharedPtr<application_manager::Application>>::iterator it = application_list_.begin();
- application_list_.end() != it; ++it) {
- if ((*it)->IsSubscribedToIVI(static_cast<uint32_t>(vehicle_info))) {
- result.push_back(*it);
- }
- }
- return result;
-}
-
-std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_with_navi() {
- std::vector<ApplicationSharedPtr> result;
- for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- application_list_.end() != it;
- ++it) {
- if ((*it)->allowed_support_navigation()) {
- result.push_back(*it);
- }
- }
- return result;
-}
ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
const utils::SharedPtr<smart_objects::SmartObject>&
request_for_registration) {
LOG4CXX_DEBUG(logger_, "Restarting application list update timer");
+ policy::PolicyHandler::instance()->OnAppsSearchStarted();
uint32_t timeout = profile::Profile::instance()->application_list_update_timeout();
application_list_update_timer_->start(timeout);
@@ -409,6 +402,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
ManageMobileCommand(response);
return ApplicationSharedPtr();
}
+
application->set_device(device_id);
application->set_grammar_id(GenerateGrammarID());
mobile_api::Language::eType launguage_desired =
@@ -429,35 +423,11 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
int32_t min_version =
message[strings::msg_params][strings::sync_msg_version]
[strings::minor_version].asInt();
-
- /*if (min_version < APIVersion::kAPIV2) {
- LOG4CXX_ERROR(logger_, "UNSUPPORTED_VERSION");
- utils::SharedPtr<smart_objects::SmartObject> response(
- MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id],
- mobile_apis::Result::UNSUPPORTED_VERSION));
- ManageMobileCommand(response);
- delete application;
- return NULL;
- }*/
version.min_supported_api_version = static_cast<APIVersion>(min_version);
int32_t max_version =
message[strings::msg_params][strings::sync_msg_version]
[strings::major_version].asInt();
-
- /*if (max_version > APIVersion::kAPIV2) {
- LOG4CXX_ERROR(logger_, "UNSUPPORTED_VERSION");
- utils::SharedPtr<smart_objects::SmartObject> response(
- MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id],
- mobile_apis::Result::UNSUPPORTED_VERSION));
- ManageMobileCommand(response);
- delete application;
- return NULL;
- }*/
version.max_supported_api_version = static_cast<APIVersion>(max_version);
application->set_version(version);
@@ -470,14 +440,18 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
connection_handler_->BindProtocolVersionWithSession(
connection_key, static_cast<uint8_t>(protocol_version));
}
- if (ProtocolVersion::kV3 == protocol_version) {
+ if (protocol_version >= ProtocolVersion::kV3 &&
+ profile::Profile::instance()->heart_beat_timeout() > 0) {
connection_handler_->StartSessionHeartBeat(connection_key);
}
}
- sync_primitives::AutoLock lock(applications_list_lock_);
-
- application_list_.insert(application);
+ apps_to_register_list_lock_.Acquire();
+ apps_to_register_.erase(application);
+ apps_to_register_list_lock_.Release();
+ ApplicationListAccessor app_list_accesor;
+ application->MarkRegistered();
+ app_list_accesor.Insert(application);
return application;
}
@@ -491,6 +465,7 @@ bool ApplicationManagerImpl::LoadAppDataToHMI(ApplicationSharedPtr app) {
}
bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!app) {
LOG4CXX_ERROR(logger_, "Null-pointer application received.");
NOTREACHED();
@@ -502,57 +477,52 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
return false;
}
+ using namespace mobile_api::HMILevel;
+
bool is_new_app_media = app->is_media_application();
ApplicationSharedPtr current_active_app = active_application();
- if (mobile_api::HMILevel::eType::HMI_LIMITED != app->hmi_level()) {
+ if (HMI_LIMITED != app->hmi_level()) {
if (app->has_been_activated()) {
MessageHelper::SendAppDataToHMI(app);
}
}
- if (current_active_app.valid()) {
+ if (current_active_app) {
if (is_new_app_media && current_active_app->is_media_application()) {
- current_active_app->MakeNotAudible();
- } else if (!(current_active_app->IsAudioApplication())) {
- current_active_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
+ MakeAppNotAudible(current_active_app->app_id());
} else {
- current_active_app->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED);
+ ChangeAppsHMILevel(current_active_app->app_id(),
+ current_active_app->IsAudioApplication() ? HMI_LIMITED :
+ HMI_BACKGROUND);
}
MessageHelper::SendHMIStatusNotification(*current_active_app);
}
- app->MakeFullscreen();
+ MakeAppFullScreen(app->app_id());
if (is_new_app_media) {
ApplicationSharedPtr limited_app = get_limited_media_application();
- if (limited_app.valid()) {
- limited_app->MakeNotAudible();
- MessageHelper::SendHMIStatusNotification(*limited_app);
- }
- }
-
- if (app->is_voice_communication_supported()) {
- ApplicationSharedPtr limited_app = get_limited_voice_application();
- if (limited_app.valid()) {
- if (limited_app->is_media_application()) {
- limited_app->set_audio_streaming_state(
- mobile_api::AudioStreamingState::NOT_AUDIBLE);
+ if (limited_app ) {
+ if (!limited_app->is_navi()) {
+ MakeAppNotAudible(limited_app->app_id());
+ MessageHelper::SendHMIStatusNotification(*limited_app);
+ } else {
+ app->set_audio_streaming_state(mobile_apis::AudioStreamingState::ATTENUATED);
+ MessageHelper::SendHMIStatusNotification(*app);
}
- limited_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
- MessageHelper::SendHMIStatusNotification(*limited_app);
}
}
- if (app->allowed_support_navigation()) {
- ApplicationSharedPtr limited_app = get_limited_navi_application();
+ if (app->is_voice_communication_supported() || app->is_navi()) {
+ ApplicationSharedPtr limited_app = get_limited_voice_application();
if (limited_app.valid()) {
if (limited_app->is_media_application()) {
limited_app->set_audio_streaming_state(
mobile_api::AudioStreamingState::NOT_AUDIBLE);
}
- limited_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
+ ChangeAppsHMILevel(app->app_id(), HMI_BACKGROUND);
MessageHelper::SendHMIStatusNotification(*limited_app);
}
}
@@ -560,30 +530,33 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
return true;
}
-mobile_api::HMILevel::eType ApplicationManagerImpl::PutApplicationInFull(
+mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
ApplicationSharedPtr app) {
- DCHECK(app.get())
-
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application pointer invalid");
+ NOTREACHED();
+ return mobile_api::HMILevel::INVALID_ENUM;
+ }
bool is_audio_app = app->IsAudioApplication();
bool does_audio_app_with_same_type_exist =
DoesAudioAppWithSameHMITypeExistInFullOrLimited(app);
+ bool is_active_app_exist = active_application().valid();
- mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL;
- bool is_active_app_exist = active_application().valid();
+ mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL;
if (is_audio_app && does_audio_app_with_same_type_exist) {
- result = mobile_apis::HMILevel::HMI_BACKGROUND;
+ result = GetDefaultHmiLevel(app);
} else if (is_active_app_exist && is_audio_app) {
result = mobile_apis::HMILevel::HMI_LIMITED;
} else if (is_active_app_exist && (!is_audio_app)) {
- result = mobile_apis::HMILevel::HMI_BACKGROUND;
- }
-
- if (mobile_api::HMILevel::HMI_FULL == result) {
- app->set_hmi_level(result);
- MessageHelper::SendActivateAppToHMI(app->app_id());
+ 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);
return result;
}
@@ -633,6 +606,7 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported));
ManageHMICommand(mixing_audio_supported_request);
+ resume_controller().ResetLaunchTime();
}
uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
@@ -691,50 +665,23 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
void ApplicationManagerImpl::SendAudioPassThroughNotification(
uint32_t session_key,
- std::vector<uint8_t> binaryData) {
- LOG4CXX_TRACE_ENTER(logger_);
+ 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");
return;
}
- smart_objects::SmartObject* on_audio_pass = NULL;
- on_audio_pass = new smart_objects::SmartObject();
- if (NULL == on_audio_pass) {
- LOG4CXX_ERROR_EXT(logger_, "OnAudioPassThru NULL pointer");
-
- return;
- }
-
- LOG4CXX_INFO_EXT(logger_, "Fill smart object");
-
- (*on_audio_pass)[strings::params][strings::message_type] =
- application_manager::MessageType::kNotification;
-
- (*on_audio_pass)[strings::params][strings::connection_key] =
- static_cast<int32_t>(session_key);
- (*on_audio_pass)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnAudioPassThruID;
-
- LOG4CXX_INFO_EXT(logger_, "Fill binary data");
- // binary data
- (*on_audio_pass)[strings::params][strings::binary_data] =
- smart_objects::SmartObject(binaryData);
-
- LOG4CXX_INFO_EXT(logger_, "After fill binary data");
-
- LOG4CXX_INFO_EXT(logger_, "Send data");
- CommandSharedPtr command (
- MobileCommandFactory::CreateCommand(&(*on_audio_pass)));
- command->Init();
- command->Run();
- command->CleanUp();
+ impl::AudioData data;
+ data.session_key = session_key;
+ data.binary_data = binary_data;
+ audio_pass_thru_messages_.PostMessage(data);
}
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (NULL != media_manager_) {
media_manager_->StopMicrophoneRecording(application_key);
@@ -761,7 +708,7 @@ std::string ApplicationManagerImpl::GetDeviceName(
void ApplicationManagerImpl::OnMessageReceived(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnMessageReceived");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
@@ -779,12 +726,12 @@ void ApplicationManagerImpl::OnMessageReceived(
void ApplicationManagerImpl::OnMobileMessageSent(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnMobileMessageSent");
+ LOG4CXX_AUTO_TRACE(logger_);
}
void ApplicationManagerImpl::OnMessageReceived(
hmi_message_handler::MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnMessageReceived");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
@@ -802,9 +749,15 @@ void ApplicationManagerImpl::OnErrorSending(
void ApplicationManagerImpl::OnDeviceListUpdated(
const connection_handler::DeviceMap& device_list) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnDeviceListUpdated");
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr msg_params = MessageHelper::CreateDeviceListSO(
+ device_list);
+ if (!msg_params) {
+ LOG4CXX_WARN(logger_, "Failed to create sub-smart object.");
+ return;
+ }
- smart_objects::SmartObject* update_list = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject;
smart_objects::SmartObject& so_to_send = *update_list;
so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] =
hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
@@ -813,13 +766,6 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 3;
so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1;
so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
- smart_objects::SmartObject* msg_params = MessageHelper::CreateDeviceListSO(
- device_list);
- if (!msg_params) {
- LOG4CXX_WARN(logger_, "Failed to create sub-smart object.");
- delete update_list;
- return;
- }
so_to_send[jhs::S_MSG_PARAMS] = *msg_params;
ManageHMICommand(update_list);
}
@@ -829,41 +775,25 @@ void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
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();
}
-void ApplicationManagerImpl::SendUpdateAppList(const std::list<uint32_t>& applications_ids) {
- LOG4CXX_TRACE(logger_, "SendUpdateAppList");
+void ApplicationManagerImpl::SendUpdateAppList() {
+ LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, applications_ids.size() << " applications.");
+ using namespace smart_objects;
+ using namespace hmi_apis;
- smart_objects::SmartObject* request = MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::BasicCommunication_UpdateAppList);
- (*request)[strings::msg_params][strings::applications] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
+ FunctionID::BasicCommunication_UpdateAppList);
- smart_objects::SmartObject& applications =
- (*request)[strings::msg_params][strings::applications];
+ (*request)[strings::msg_params][strings::applications] = SmartObject(SmartType_Array);
- uint32_t app_count = 0;
- for (std::list<uint32_t>::const_iterator it = applications_ids.begin();
- it != applications_ids.end(); ++it) {
- ApplicationSharedPtr app = application(*it);
+ SmartObject& applications = (*request)[strings::msg_params][strings::applications];
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Application not found , id = " << *it);
- continue;
- }
+ PrepareApplicationListSO(applications_, applications);
+ PrepareApplicationListSO(apps_to_register_, applications);
- smart_objects::SmartObject hmi_application(smart_objects::SmartType_Map);;
- if (!MessageHelper::CreateHMIApplicationStruct(app, hmi_application)) {
- LOG4CXX_ERROR(logger_, "Can't CreateHMIApplicationStruct ', id = " << *it);
- continue;
- }
- applications[app_count++] = hmi_application;
- }
- if (app_count <= 0) {
- LOG4CXX_WARN(logger_, "Empty applications list");
- }
ManageHMICommand(request);
}
@@ -875,37 +805,59 @@ void ApplicationManagerImpl::RemoveDevice(
bool ApplicationManagerImpl::IsAudioStreamingAllowed(uint32_t application_key) const {
ApplicationSharedPtr app = application(application_key);
+ using namespace mobile_apis::HMILevel;
+ using namespace helpers;
if (!app) {
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- const mobile_api::HMILevel::eType& hmi_level = app->hmi_level();
-
- if (mobile_api::HMILevel::HMI_FULL == hmi_level ||
- mobile_api::HMILevel::HMI_LIMITED == hmi_level) {
- return true;
- }
-
- return false;
+ return Compare<eType, EQ, ONE>(
+ app->hmi_level(), HMI_FULL, HMI_LIMITED);
}
bool ApplicationManagerImpl::IsVideoStreamingAllowed(uint32_t application_key) const {
ApplicationSharedPtr app = application(application_key);
+ using namespace mobile_apis::HMILevel;
+ using namespace helpers;
if (!app) {
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- const mobile_api::HMILevel::eType& hmi_level = app->hmi_level();
+ LOG4CXX_DEBUG(logger_, "HMILevel: " << app->hmi_level());
+ return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
+}
- if (mobile_api::HMILevel::HMI_FULL == hmi_level &&
- app->hmi_supports_navi_video_streaming()) {
- return true;
- }
+mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
+ ApplicationSharedPtr application) const {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ HMILevel::eType default_hmi = HMILevel::HMI_NONE;
- return false;
+ if (policy::PolicyHandler::instance()->PolicyEnabled()) {
+ const std::string policy_app_id = application->mobile_app_id();
+ std::string default_hmi_string = "";
+ if (policy::PolicyHandler::instance()->GetDefaultHmi(
+ policy_app_id, &default_hmi_string)) {
+ if ("BACKGROUND" == default_hmi_string) {
+ default_hmi = HMILevel::HMI_BACKGROUND;
+ } else if ("FULL" == default_hmi_string) {
+ default_hmi = HMILevel::HMI_FULL;
+ } else if ("LIMITED" == default_hmi_string) {
+ default_hmi = HMILevel::HMI_LIMITED;
+ } else if ("NONE" == default_hmi_string) {
+ default_hmi = HMILevel::HMI_NONE;
+ } else {
+ 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);
+ }
+ }
+ return default_hmi;
}
uint32_t ApplicationManagerImpl::GenerateGrammarID() {
@@ -913,19 +865,23 @@ uint32_t ApplicationManagerImpl::GenerateGrammarID() {
}
uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
- uint32_t hmi_app_id = rand();
+ LOG4CXX_TRACE(logger_, "ENTER");
+ uint32_t hmi_app_id = get_rand_from_range(1);
+ LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id);
while (resume_ctrl_.IsHMIApplicationIdExist(hmi_app_id)) {
- hmi_app_id = rand();
+ LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists.");
+ hmi_app_id = get_rand_from_range(1);
+ LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id);
}
+ LOG4CXX_TRACE(logger_, "EXIT");
return hmi_app_id;
}
void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
smart_objects::SmartObject& message) {
MessageHelper::PrintSmartObject(message);
- flush(std::cout);
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(
@@ -998,96 +954,133 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
}
}
-bool ApplicationManagerImpl::OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) {
- LOG4CXX_INFO(logger_,
- "OnServiceStartedCallback " << type << " in session " << session_key);
- ApplicationSharedPtr app = application(session_key);
+bool ApplicationManagerImpl::ProcessNaviService(protocol_handler::ServiceType type,
+ uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!media_manager_) {
+ LOG4CXX_DEBUG(logger_, "The media manager is not initialized.");
+ return false;
+ }
+ bool result = false;
switch (type) {
- case protocol_handler::kRpc: {
- LOG4CXX_INFO(logger_, "RPC service is about to be started.");
- break;
- }
- case protocol_handler::kMobileNav: {
- LOG4CXX_INFO(logger_, "Video service is about to be started.");
- if (media_manager_) {
- if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
- return false;
- }
- if (app->allowed_support_navigation()) {
- media_manager_->StartVideoStreaming(session_key);
- } else {
- return false;
- }
+ case protocol_handler::kMobileNav:
+ LOG4CXX_DEBUG(logger_, "Video service is about to be started.");
+ if (IsVideoStreamingAllowed(connection_key)) {
+ media_manager_->StartVideoStreaming(connection_key);
+ result = true;
}
break;
- }
- case protocol_handler::kAudio: {
- LOG4CXX_INFO(logger_, "Audio service is about to be started.");
- if (media_manager_) {
- if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
- return false;
- }
- if (app->allowed_support_navigation()) {
- media_manager_->StartAudioStreaming(session_key);
- } else {
- return false;
- }
+ case protocol_handler::kAudio:
+ LOG4CXX_DEBUG(logger_, "Audio service is about to be started.");
+ if (IsAudioStreamingAllowed(connection_key)) {
+ media_manager_->StartAudioStreaming(connection_key);
+ result = true;
}
break;
- }
- default: {
- LOG4CXX_WARN(logger_, "Unknown type of service to be started.");
+ default:
+ LOG4CXX_DEBUG(logger_, "Unknown type of service to be started.");
break;
- }
}
- return true;
+ service_status_[type] = std::make_pair(result, false);
+ return result;
+}
+
+bool ApplicationManagerImpl::OnServiceStartedCallback(
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type) {
+ using namespace protocol_handler;
+ using namespace helpers;
+
+ LOG4CXX_INFO(logger_,
+ "OnServiceStartedCallback " << type << " in session " << session_key);
+ if (type == kRpc) {
+ LOG4CXX_INFO(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.");
+ return false;
+ }
+ bool result = false;
+ if (Compare<ServiceType, EQ, ONE>(type, kMobileNav, kAudio)) {
+ if (app->is_navi()) {
+ result = ProcessNaviService(type, session_key);
+ app->set_streaming_allowed(result);
+ }
+ }
+ return result;
}
void ApplicationManagerImpl::OnServiceEndedCallback(const int32_t& session_key,
const protocol_handler::ServiceType& type) {
+ using namespace protocol_handler;
LOG4CXX_INFO_EXT(
logger_,
"OnServiceEndedCallback " << type << " in session " << session_key);
- switch (type) {
- case protocol_handler::kRpc: {
- LOG4CXX_INFO(logger_, "Remove application.");
- /* in case it was unexpected disconnect application will be removed
- and we will notify HMI that it was unexpected disconnect,
- but in case it was closed by mobile we will be unable to find it in the list
- */
- UnregisterApplication(session_key, mobile_apis::Result::INVALID_ENUM,
- true, true);
- break;
- }
- case protocol_handler::kMobileNav: {
- LOG4CXX_INFO(logger_, "Stop video streaming.");
- if (media_manager_) {
+ if (type == kRpc) {
+ LOG4CXX_INFO(logger_, "Remove application.");
+ /* in case it was unexpected disconnect application will be removed
+ and we will notify HMI that it was unexpected disconnect,
+ but in case it was closed by mobile we will be unable to find it in the list
+ */
+ UnregisterApplication(session_key, mobile_apis::Result::INVALID_ENUM,
+ true, true);
+ return;
+ }
+
+ if (media_manager_) {
+ switch (type) {
+ case protocol_handler::kMobileNav: {
+ LOG4CXX_INFO(logger_, "Stop video streaming.");
media_manager_->StopVideoStreaming(session_key);
+ break;
}
- break;
- }
- case protocol_handler::kAudio: {
- LOG4CXX_INFO(logger_, "Stop audio service.");
- if (media_manager_) {
+ case protocol_handler::kAudio: {
+ LOG4CXX_INFO(logger_, "Stop audio service.");
media_manager_->StopAudioStreaming(session_key);
+ break;
}
- break;
+ default:
+ LOG4CXX_WARN(logger_, "Unknown type of service to be ended." << type);
+ break;
}
- default:
- LOG4CXX_WARN(logger_, "Unknown type of service to be ended." <<
- type);
- break;
+ service_status_[type].second = true;
+ LOG4CXX_DEBUG(logger_, "Ack status: " << service_status_[type].first <<" : "
+ << service_status_[type].second);
}
}
+void ApplicationManagerImpl::OnApplicationFloodCallBack(const uint32_t &connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Unregister flooding application " << connection_key);
+
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS);
+
+ const bool resuming = true;
+ const bool unexpected_disconnect = false;
+ UnregisterApplication(connection_key, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS,
+ resuming, unexpected_disconnect);
+ // TODO(EZamakhov): increment "removals_for_bad_behaviour" field in policy table
+}
+
+void ApplicationManagerImpl::OnMalformedMessageCallback(const uint32_t &connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Unregister malformed messaging application " << connection_key);
+
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::PROTOCOL_VIOLATION);
+}
+
void ApplicationManagerImpl::set_hmi_message_handler(
hmi_message_handler::HMIMessageHandler* handler) {
hmi_handler_ = handler;
@@ -1113,9 +1106,8 @@ void ApplicationManagerImpl::StartDevicesDiscovery() {
}
void ApplicationManagerImpl::SendMessageToMobile(
- const utils::SharedPtr<smart_objects::SmartObject> message,
- bool final_message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::SendMessageToMobile");
+ const commands::MessageSharedPtr message, bool final_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
@@ -1141,7 +1133,7 @@ void ApplicationManagerImpl::SendMessageToMobile(
ProtocolVersion::kV1;
} else {
(*message)[strings::params][strings::protocol_version] =
- ProtocolVersion::kV3;
+ SupportedSDLVersion();
}
} else {
(*message)[strings::params][strings::protocol_version] =
@@ -1166,7 +1158,8 @@ void ApplicationManagerImpl::SendMessageToMobile(
// checked against policy permissions
if (msg_to_mobile[strings::params].keyExists(strings::correlation_id)) {
request_ctrl_.terminateMobileRequest(
- msg_to_mobile[strings::params][strings::correlation_id].asInt());
+ msg_to_mobile[strings::params][strings::correlation_id].asInt(),
+ msg_to_mobile[strings::params][strings::connection_key].asInt());
} else if (app) {
mobile_apis::FunctionID::eType function_id =
static_cast<mobile_apis::FunctionID::eType>(
@@ -1179,11 +1172,14 @@ void ApplicationManagerImpl::SendMessageToMobile(
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
for (; iter != iter_end; ++iter) {
- params.push_back(iter->first);
+ if (true == iter->second.asBool()) {
+ LOG4CXX_INFO(logger_, "Request's param: " << iter->first);
+ params.push_back(iter->first);
+ }
}
}
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions( app->mobile_app_id()->asString(),
+ CheckPolicyPermissions( app->mobile_app_id(),
app->hmi_level(), function_id, params);
if (mobile_apis::Result::SUCCESS != check_result) {
const std::string string_functionID =
@@ -1194,7 +1190,13 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
if (function_id == mobile_apis::FunctionID::OnSystemRequestID) {
- policy::PolicyHandler::instance()->OnUpdateRequestSentToMobile();
+ mobile_apis::RequestType::eType request_type =
+ static_cast<mobile_apis::RequestType::eType>(
+ (*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();
+ }
}
}
@@ -1203,21 +1205,26 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
bool ApplicationManagerImpl::ManageMobileCommand(
- const utils::SharedPtr<smart_objects::SmartObject> message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ManageMobileCommand");
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandOrigin origin) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_WARN(logger_, "RET Null-pointer message received.");
- NOTREACHED()
return false;
}
+ if (IsLowVoltage()) {
+ LOG4CXX_WARN(logger_, "Low Voltage is active");
+ return false;
+ }
#ifdef DEBUG
MessageHelper::PrintSmartObject(*message);
#endif
LOG4CXX_INFO(logger_, "Trying to create message in mobile factory.");
- commands::Command* command = MobileCommandFactory::CreateCommand(message);
+ utils::SharedPtr<commands::Command> command(
+ MobileCommandFactory::CreateCommand(message, origin));
if (!command) {
LOG4CXX_WARN(logger_, "RET Failed to create mobile command from smart object");
@@ -1249,12 +1256,11 @@ bool ApplicationManagerImpl::ManageMobileCommand(
app = ApplicationManagerImpl::instance()->application(connection_key);
if (!app) {
LOG4CXX_ERROR_EXT(logger_, "RET APPLICATION_NOT_REGISTERED");
- smart_objects::SmartObject* response =
- MessageHelper::CreateNegativeResponse(
- connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateNegativeResponse(connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
SendMessageToMobile(response);
return false;
@@ -1270,18 +1276,15 @@ bool ApplicationManagerImpl::ManageMobileCommand(
command->Run();
command->CleanUp();
}
- delete command;
return true;
}
if (message_type ==
mobile_apis::messageType::notification) {
- commands::CommandNotificationImpl* command_notify =
- static_cast<commands::CommandNotificationImpl*>(command);
- request_ctrl_.addNotification(command_notify);
- if (command_notify->Init()) {
- command_notify->Run();
- if (command_notify->CleanUp()) {
- request_ctrl_.removeNotification(command_notify);
+ request_ctrl_.addNotification(command);
+ if (command->Init()) {
+ command->Run();
+ if (command->CleanUp()) {
+ request_ctrl_.removeNotification(command.get());
}
// If CleanUp returned false notification should remove it self.
}
@@ -1291,8 +1294,6 @@ bool ApplicationManagerImpl::ManageMobileCommand(
if (message_type ==
mobile_apis::messageType::request) {
- commands::CommandRequestImpl* command_request =
- static_cast<commands::CommandRequestImpl*>(command);
// commands will be launched from requesr_ctrl
mobile_apis::HMILevel::eType app_hmi_level = mobile_apis::HMILevel::INVALID_ENUM;
if (app) {
@@ -1301,8 +1302,8 @@ bool ApplicationManagerImpl::ManageMobileCommand(
// commands will be launched from request_ctrl
- request_controller::RequestController::TResult result =
- request_ctrl_.addMobileRequest(command_request, app_hmi_level);
+ const request_controller::RequestController::TResult result =
+ request_ctrl_.addMobileRequest(command, app_hmi_level);
if (result == request_controller::RequestController::SUCCESS) {
LOG4CXX_INFO(logger_, "Perform request");
@@ -1312,12 +1313,11 @@ bool ApplicationManagerImpl::ManageMobileCommand(
LOG4CXX_ERROR_EXT(logger_, "RET Unable top perform request: " <<
"TOO_MANY_PENDING_REQUESTS");
- smart_objects::SmartObject* response =
- MessageHelper::CreateNegativeResponse(
- connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateNegativeResponse(connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
SendMessageToMobile(response);
return false;
@@ -1344,7 +1344,10 @@ bool ApplicationManagerImpl::ManageMobileCommand(
connection_key, mobile_api::AppInterfaceUnregisteredReason::
REQUEST_WHILE_IN_NONE_HMI_LEVEL);
- application(connection_key)->usage_report().RecordRemovalsForBadBehavior();
+ ApplicationSharedPtr app_ptr = application(connection_key);
+ if(app_ptr) {
+ app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ }
UnregisterApplication(connection_key, mobile_apis::Result::INVALID_ENUM,
false);
return false;
@@ -1360,8 +1363,8 @@ bool ApplicationManagerImpl::ManageMobileCommand(
}
void ApplicationManagerImpl::SendMessageToHMI(
- const utils::SharedPtr<smart_objects::SmartObject> message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::SendMessageToHMI");
+ const commands::MessageSharedPtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_WARN(logger_, "Null-pointer message received.");
@@ -1387,7 +1390,6 @@ void ApplicationManagerImpl::SendMessageToHMI(
logger_,
"Attached schema to message, result if valid: " << message->isValid());
-
#ifdef HMI_DBUS_API
message_to_send->set_smart_object(*message);
#else
@@ -1402,15 +1404,18 @@ void ApplicationManagerImpl::SendMessageToHMI(
}
bool ApplicationManagerImpl::ManageHMICommand(
- const utils::SharedPtr<smart_objects::SmartObject> message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ManageHMICommand");
+ const commands::MessageSharedPtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_WARN(logger_, "Null-pointer message received.");
- NOTREACHED();
return false;
}
+ if (IsLowVoltage()) {
+ LOG4CXX_WARN(logger_, "Low Voltage is active");
+ return false;
+ }
MessageHelper::PrintSmartObject(*message);
@@ -1440,19 +1445,6 @@ bool ApplicationManagerImpl::ManageHMICommand(
bool ApplicationManagerImpl::Init() {
LOG4CXX_TRACE(logger_, "Init application manager");
- if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- if(!policy::PolicyHandler::instance()->LoadPolicyLibrary()) {
- LOG4CXX_ERROR(logger_, "Policy library is not loaded. Check LD_LIBRARY_PATH");
- return false;
- }
- LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT");
- if (!policy::PolicyHandler::instance()->InitPolicyTable()) {
- LOG4CXX_ERROR(logger_, "Policy table is not initialized.");
- return false;
- }
- } else {
- LOG4CXX_WARN(logger_, "System is configured to work without policy functionality.");
- }
const std::string app_storage_folder =
profile::Profile::instance()->app_storage_folder();
if (!file_system::DirectoryExists(app_storage_folder)) {
@@ -1488,6 +1480,19 @@ bool ApplicationManagerImpl::Init() {
"System directory doesn't have read/write permissions");
return false;
}
+ if (policy::PolicyHandler::instance()->PolicyEnabled()) {
+ if(!policy::PolicyHandler::instance()->LoadPolicyLibrary()) {
+ LOG4CXX_ERROR(logger_, "Policy library is not loaded. Check LD_LIBRARY_PATH");
+ return false;
+ }
+ LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT");
+ if (!policy::PolicyHandler::instance()->InitPolicyTable()) {
+ LOG4CXX_ERROR(logger_, "Policy table is not initialized.");
+ return false;
+ }
+ } else {
+ LOG4CXX_WARN(logger_, "System is configured to work without policy functionality.");
+ }
media_manager_ = media_manager::MediaManagerImpl::instance();
return true;
}
@@ -1500,6 +1505,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
<< "; json " << message.json_message());
switch (message.protocol_version()) {
+ case ProtocolVersion::kV4:
case ProtocolVersion::kV3:
case ProtocolVersion::kV2: {
const bool conversion_result =
@@ -1559,7 +1565,20 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
return false;
}
if (output.validate() != smart_objects::Errors::OK) {
- LOG4CXX_WARN(logger_, "Incorrect parameter from HMI");
+ 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");
+ return false;
+ }
+
output.erase(strings::msg_params);
output[strings::params][hmi_response::code] =
hmi_apis::Common_Result::INVALID_DATA;
@@ -1595,7 +1614,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
output[strings::msg_params][strings::result_code] =
NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
- smart_objects::SmartObject* msg_to_send = new smart_objects::SmartObject(output);
+ smart_objects::SmartObjectSPtr msg_to_send = new smart_objects::SmartObject(output);
v1_shema.attachSchema(*msg_to_send);
SendMessageToMobile(msg_to_send);
return false;
@@ -1728,18 +1747,7 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage(
return outgoing_message;
}
- Message* convertion_result = NULL;
- if (message->protocol_version() == 1) {
- convertion_result =
- MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
- } else if ((message->protocol_version() == 2) ||
- (message->protocol_version() == 3)) {
- convertion_result =
- MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
- } else {
- LOG4CXX_WARN(logger_, "Unknown protocol version.");
- return outgoing_message;
- }
+ Message* convertion_result = MobileMessageHandler::HandleIncomingMessageProtocol(message);
if (convertion_result) {
outgoing_message = convertion_result;
@@ -1756,8 +1764,7 @@ void ApplicationManagerImpl::ProcessMessageFromMobile(
AMMetricObserver::MessageMetricSharedPtr metric(new AMMetricObserver::MessageMetric());
metric->begin = date_time::DateTime::getCurrentTime();
#endif // TIME_TESTER
- utils::SharedPtr<smart_objects::SmartObject> so_from_mobile(
- new smart_objects::SmartObject);
+ smart_objects::SmartObjectSPtr so_from_mobile(new smart_objects::SmartObject);
if (!so_from_mobile) {
LOG4CXX_ERROR(logger_, "Null pointer");
@@ -1772,7 +1779,8 @@ void ApplicationManagerImpl::ProcessMessageFromMobile(
metric->message = so_from_mobile;
#endif // TIME_TESTER
- if (!ManageMobileCommand(so_from_mobile)) {
+ if (!ManageMobileCommand(so_from_mobile,
+ commands::Command::ORIGIN_MOBILE)) {
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
#ifdef TIME_TESTER
@@ -1786,8 +1794,7 @@ void ApplicationManagerImpl::ProcessMessageFromMobile(
void ApplicationManagerImpl::ProcessMessageFromHMI(
const utils::SharedPtr<Message> message) {
LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ProcessMessageFromHMI()");
- utils::SharedPtr<smart_objects::SmartObject> smart_object(
- new smart_objects::SmartObject);
+ smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject);
if (!smart_object) {
LOG4CXX_ERROR(logger_, "Null pointer");
@@ -1835,6 +1842,63 @@ HMICapabilities& ApplicationManagerImpl::hmi_capabilities() {
return hmi_capabilities_;
}
+void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array) {
+
+ using namespace policy;
+
+ 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];
+ if (app_data.isValid()) {
+ const std::string url_schema(app_data[strings::urlSchema].asString());
+ const std::string package_name(app_data[strings::packageName].asString());
+ const std::string mobile_app_id(app_data[strings::app_id].asString());
+ const std::string appName(app_data[strings::app_name].asString());
+
+ const uint32_t hmi_app_id(GenerateNewHMIAppID());
+
+ ApplicationSharedPtr app(
+ new ApplicationImpl(0,
+ mobile_app_id,
+ appName,
+ PolicyHandler::instance()->GetStatisticManager()));
+ if (app) {
+ app->SetShemaUrl(url_schema);
+ app->SetPackageName(package_name);
+ app->set_hmi_application_id(hmi_app_id);
+
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_);
+ apps_to_register_.insert(app);
+ }
+ }
+ }
+}
+
+void ApplicationManagerImpl::ProcessQueryApp(
+ const smart_objects::SmartObject& sm_object) {
+ using namespace policy;
+ using namespace profile;
+
+ if (sm_object.keyExists(strings::application)) {
+ SmartArray* obj_array = sm_object[strings::application].asArray();
+ if (NULL != obj_array) {
+ const std::string app_icon_dir(Profile::instance()->app_icons_folder());
+ CreateApplications(*obj_array);
+ SendUpdateAppList();
+
+ AppsWaitRegistrationSet::const_iterator it = apps_to_register_.begin();
+ for (; it != apps_to_register_.end(); ++it) {
+
+ const std::string full_icon_path(app_icon_dir + "/" + (*it)->mobile_app_id());
+ if (file_system::FileExists(full_icon_path)) {
+ MessageHelper::SendSetAppIcon((*it)->hmi_app_id(), full_icon_path);
+ }
+ }
+ }
+ }
+}
+
#ifdef TIME_TESTER
void ApplicationManagerImpl::SetTimeMetricObserver(AMMetricObserver* observer) {
metric_observer_ = observer;
@@ -1852,6 +1916,7 @@ void ApplicationManagerImpl::removeNotification(const commands::Command* notific
void ApplicationManagerImpl::updateRequestTimeout(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) {
+ LOG4CXX_AUTO_TRACE(logger_);
request_ctrl_.updateRequestTimeout(connection_key, mobile_correlation_id,
new_timeout_value);
}
@@ -1876,8 +1941,17 @@ void ApplicationManagerImpl::set_application_id(const int32_t correlation_id,
(correlation_id, app_id));
}
+void ApplicationManagerImpl::AddPolicyObserver( policy::PolicyHandlerObserver* listener) {
+ policy::PolicyHandler::instance()->add_listener(listener);
+}
+
+void ApplicationManagerImpl::RemovePolicyObserver(policy::PolicyHandlerObserver* listener) {
+ policy::PolicyHandler::instance()->remove_listener(listener);
+}
+
void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
+ LOG4CXX_TRACE(logger_, "reason = " << reason);
unregister_reason_ = reason;
}
@@ -1885,9 +1959,12 @@ void ApplicationManagerImpl::HeadUnitReset(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
switch (reason) {
case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: {
- file_system::remove_directory_content(profile::Profile::instance()->app_storage_folder());
- resume_controller().ClearResumptionInfo();
+ UnregisterAllApplications();
policy::PolicyHandler::instance()->ResetPolicyTable();
+ policy::PolicyHandler::instance()->UnloadPolicyLibrary();
+
+ resume_controller().StopSavePersistentDataTimer();
+ file_system::remove_directory_content(profile::Profile::instance()->app_storage_folder());
break;
}
case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: {
@@ -1901,15 +1978,12 @@ void ApplicationManagerImpl::HeadUnitReset(
}
}
-void ApplicationManagerImpl::HeadUnitSuspend() {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::HeadUnitSuspend");
-}
void ApplicationManagerImpl::SendOnSDLClose() {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::SendOnSDLClose");
+ LOG4CXX_AUTO_TRACE(logger_);
// must be sent to PASA HMI on shutdown synchronously
- smart_objects::SmartObject* msg = new smart_objects::SmartObject(
+ smart_objects::SmartObjectSPtr msg = new smart_objects::SmartObject(
smart_objects::SmartType_Map);
(*msg)[strings::params][strings::function_id] =
@@ -1952,39 +2026,38 @@ void ApplicationManagerImpl::SendOnSDLClose() {
return;
}
- delete msg;
hmi_handler_->SendMessageToHMI(message_to_send);
}
-void ApplicationManagerImpl::UnregisterAllApplications(bool generated_by_hmi) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::UnregisterAllApplications " <<
- unregister_reason_);
- hmi_cooperating_ = false;
-
- bool is_ignition_off =
- unregister_reason_ ==
- mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF ? true : false;
-
- bool is_unexpected_disconnect = (generated_by_hmi != true);
-
- sync_primitives::AutoLock lock(applications_list_lock_);
+void ApplicationManagerImpl::UnregisterAllApplications() {
+ LOG4CXX_DEBUG(logger_, "Unregister reason " << unregister_reason_);
- std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- while (it != application_list_.end()) {
+ hmi_cooperating_ = false;
+ bool is_ignition_off = false;
+ using namespace mobile_api::AppInterfaceUnregisteredReason;
+ using namespace helpers;
+
+ is_ignition_off =
+ Compare<eType, EQ, ONE>(unregister_reason_, IGNITION_OFF, INVALID_ENUM);
+
+ bool is_unexpected_disconnect =
+ Compare<eType, NEQ, ALL>(unregister_reason_,
+ IGNITION_OFF, MASTER_RESET, FACTORY_DEFAULTS);
+ ApplicationListAccessor accessor;
+ ApplictionSetConstIt it = accessor.begin();
+ while (it != accessor.end()) {
ApplicationSharedPtr app_to_remove = *it;
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app_to_remove->app_id(), unregister_reason_);
+
UnregisterApplication(app_to_remove->app_id(),
mobile_apis::Result::INVALID_ENUM, is_ignition_off,
is_unexpected_disconnect);
-
- connection_handler_->CloseSession(app_to_remove->app_id());
- it = application_list_.begin();
+ connection_handler_->CloseSession(app_to_remove->app_id(),
+ connection_handler::kCommon);
+ it = accessor.begin();
}
-
if (is_ignition_off) {
- resume_controller().IgnitionOff();
+ resume_controller().Suspend();
}
request_ctrl_.terminateAllHMIRequests();
}
@@ -1992,12 +2065,15 @@ void ApplicationManagerImpl::UnregisterAllApplications(bool generated_by_hmi) {
void ApplicationManagerImpl::UnregisterApplication(
const uint32_t& app_id, mobile_apis::Result::eType reason,
bool is_resuming, bool is_unexpected_disconnect) {
- LOG4CXX_INFO(logger_,
- "ApplicationManagerImpl::UnregisterApplication " << app_id);
+ LOG4CXX_INFO(logger_, "app_id = " << app_id
+ << "; reason = " << reason
+ << "; is_resuming = " << is_resuming
+ << "; is_unexpected_disconnect = " << is_unexpected_disconnect);
//remove appID from tts_global_properties_app_list_
- RemoveAppFromTTSGlobalPropertiesList(app_id);
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, unregister_reason_);
- sync_primitives::AutoLock lock(applications_list_lock_);
+ RemoveAppFromTTSGlobalPropertiesList(app_id);
switch (reason) {
case mobile_apis::Result::SUCCESS:break;
@@ -2006,7 +2082,10 @@ void ApplicationManagerImpl::UnregisterApplication(
case mobile_apis::Result::INVALID_CERT: break;
case mobile_apis::Result::EXPIRED_CERT: break;
case mobile_apis::Result::TOO_MANY_PENDING_REQUESTS: {
- application(app_id)->usage_report().RecordRemovalsForBadBehavior();
+ ApplicationSharedPtr app_ptr = application(app_id);
+ if(app_ptr) {
+ app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ }
break;
}
default: {
@@ -2016,21 +2095,25 @@ void ApplicationManagerImpl::UnregisterApplication(
}
ApplicationSharedPtr app_to_remove;
- std::set<ApplicationSharedPtr>::const_iterator it = application_list_.begin();
- for (; it != application_list_.end(); ++it) {
- if ((*it)->app_id() == app_id) {
- app_to_remove = *it;
- break;
+ {
+ ApplicationListAccessor accessor;
+ ApplictionSetConstIt it = accessor.begin();
+ for (; it != accessor.end(); ++it) {
+ if ((*it)->app_id() == app_id) {
+ app_to_remove = *it;
+ break;
+ }
}
+ if (!app_to_remove) {
+ LOG4CXX_ERROR(logger_, "Cant find application with app_id = " << app_id);
+ return;
+ }
+ accessor.Erase(app_to_remove);
}
- if (!app_to_remove) {
- LOG4CXX_ERROR(logger_, "Cant find application with app_id = " << app_id);
- return;
- }
- application_list_.erase(app_to_remove);
-
if (is_resuming) {
- resume_ctrl_.SaveApplication(app_to_remove);
+ resume_ctrl_.SaveApplication(app_to_remove);
+ } else {
+ resume_ctrl_.RemoveApplicationFromSaved(app_to_remove->mobile_app_id());
}
if (audio_pass_thru_active_) {
@@ -2047,15 +2130,8 @@ void ApplicationManagerImpl::UnregisterApplication(
}
-void ApplicationManagerImpl::UnregisterRevokedApplication(
- const uint32_t& app_id, mobile_apis::Result::eType reason) {
- UnregisterApplication(app_id, reason);
-
- connection_handler_->CloseSession(app_id);
-
- if (application_list_.empty()) {
- connection_handler_->CloseRevokedConnection(app_id);
- }
+void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
+ connection_handler_->CloseSession(app_id, connection_handler::kCommon);
}
void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) {
@@ -2069,26 +2145,19 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) {
}
void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) {
- protocol_handler::RawMessage* rawMessage = 0;
- if (message->protocol_version() == application_manager::kV1) {
- rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV1(message);
- } else if ((message->protocol_version() == application_manager::kV2) ||
- (message->protocol_version() == application_manager::kV3)) {
- rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
- } else {
- return;
- }
- if (!rawMessage) {
- LOG4CXX_ERROR(logger_, "Failed to create raw message.");
- return;
- }
-
if (!protocol_handler_) {
LOG4CXX_WARN(logger_,
"Protocol Handler is not set; cannot send message to mobile.");
return;
}
+ utils::SharedPtr<protocol_handler::RawMessage> rawMessage =
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message);
+
+ if (!rawMessage) {
+ LOG4CXX_ERROR(logger_, "Failed to create raw message.");
+ return;
+ }
bool is_final = message.is_final;
bool close_session = false;
@@ -2103,7 +2172,8 @@ 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);
}
}
@@ -2129,6 +2199,41 @@ void ApplicationManagerImpl::Handle(const impl::MessageToHmi message) {
LOG4CXX_INFO(logger_, "Message to hmi given away.");
}
+void ApplicationManagerImpl::Handle(const impl::AudioData message) {
+ LOG4CXX_INFO(logger_, "Send AudioPassThru notification");
+ smart_objects::SmartObjectSPtr on_audio_pass = new smart_objects::SmartObject();
+
+ if (!on_audio_pass) {
+ LOG4CXX_ERROR_EXT(logger_, "OnAudioPassThru NULL pointer");
+ return;
+ }
+
+ LOG4CXX_INFO_EXT(logger_, "Fill smart object");
+
+ (*on_audio_pass)[strings::params][strings::message_type] =
+ application_manager::MessageType::kNotification;
+
+ (*on_audio_pass)[strings::params][strings::connection_key] =
+ static_cast<int32_t>(message.session_key);
+ (*on_audio_pass)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnAudioPassThruID;
+
+ LOG4CXX_INFO_EXT(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");
+ CommandSharedPtr command (
+ MobileCommandFactory::CreateCommand(on_audio_pass,
+ commands::Command::ORIGIN_SDL));
+ command->Init();
+ command->Run();
+ command->CleanUp();
+}
+
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const std::string& policy_app_id,
mobile_apis::HMILevel::eType hmi_level,
@@ -2200,16 +2305,185 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
return mobile_api::Result::SUCCESS;
}
+
+void ApplicationManagerImpl::OnLowVoltage() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_low_voltage_ = true;
+ request_ctrl_.OnLowVoltage();
+}
+
+bool ApplicationManagerImpl::IsLowVoltage() {
+ LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_);
+ return is_low_voltage_;
+}
+
+void ApplicationManagerImpl::NaviAppStreamStatus(bool stream_active) {
+ ApplicationSharedPtr active_app = active_application();
+ using namespace mobile_apis;
+ if(active_app && active_app->is_media_application()) {
+ LOG4CXX_DEBUG(logger_, "Stream status: " << active_app->app_id());
+
+ active_app->set_audio_streaming_state(stream_active ?
+ AudioStreamingState::ATTENUATED :
+ AudioStreamingState::AUDIBLE);
+ MessageHelper::SendHMIStatusNotification(*active_app);
+ }
+}
+
+void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace protocol_handler;
+ ApplicationSharedPtr app = application(app_id);
+ if (!(app && app->is_navi())) {
+ LOG4CXX_DEBUG(logger_, " There is no application with id: " << app_id);
+ return;
+ }
+
+ if (connection_handler_) {
+ const bool send_end_service = true;
+ const bool ack_received = false;
+ if (app->hmi_supports_navi_video_streaming()) {
+ LOG4CXX_DEBUG(logger_, "Going to end video service");
+ connection_handler_->SendEndService(navi_app_to_stop_, kMobileNav);
+ service_status_[kMobileNav] = std::make_pair(send_end_service, ack_received);
+ }
+ if (app->hmi_supports_navi_audio_streaming()) {
+ LOG4CXX_DEBUG(logger_, "Going to end audio service");
+ connection_handler_->SendEndService(navi_app_to_stop_, kAudio);
+ service_status_[kAudio] = std::make_pair(send_end_service, ack_received);
+ }
+ }
+ // this timer will check if appropriate acks from mobile were received.
+ // in case no acks, the application will be unregistered.
+ end_services_timer.start(wait_end_service_timeout_, this, &ApplicationManagerImpl::CloseNaviApp);
+ bool const allow_streaming = false;
+ ChangeStreamStatus(app_id, allow_streaming);
+}
+
+bool ApplicationManagerImpl::CanAppStream(uint32_t app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application(app_id);
+ if (!(app && app->is_navi())) {
+ LOG4CXX_DEBUG(logger_, " There is no application with id: " << app_id);
+ return false;
+ }
+
+ return app->is_streaming_allowed();
+}
+
+void ApplicationManagerImpl::ChangeStreamStatus(uint32_t app_id, bool can_stream) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, " There is no application with id: " << app_id);
+ return;
+ }
+
+ // Change streaming status only in case incoming value is different.
+ if (can_stream != app->streaming()) {
+ NaviAppStreamStatus(can_stream);
+ app->set_streaming(can_stream);
+ }
+}
+
+void ApplicationManagerImpl::StreamingEnded(uint32_t app_id) {
+ LOG4CXX_DEBUG(logger_, "Streaming has been stoped.");
+ ChangeStreamStatus(app_id, false);
+}
+
+void ApplicationManagerImpl::OnHMILevelChanged(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to) {
+ using namespace mobile_apis::HMILevel;
+ using namespace helpers;
+
+ ApplicationSharedPtr app = application(app_id);
+ if (!(app && app->is_navi())) {
+ return;
+ }
+
+ if (Compare<eType, EQ, ONE>(from, HMI_FULL, HMI_LIMITED)) {
+ navi_app_to_stop_ = app_id;
+ NaviAppChangeLevel(to);
+ } else if (Compare<eType, EQ, ONE>(to, HMI_FULL, HMI_LIMITED)) {
+ LOG4CXX_DEBUG(logger_, "Restore streaming ability");
+ app->set_streaming_allowed(true);
+ }
+}
+
+void ApplicationManagerImpl::EndNaviServices() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application(navi_app_to_stop_);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "The application doesn't exists anymore.");
+ return;
+ }
+ app->set_streaming_allowed(false);
+}
+
+void ApplicationManagerImpl::CloseNaviApp() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis::AppInterfaceUnregisteredReason;
+ using namespace mobile_apis::Result;
+ using namespace protocol_handler;
+ const bool is_ack_received = AckReceived(kAudio) && AckReceived(kMobileNav);
+ if (!is_ack_received) {
+ SetUnregisterAllApplicationsReason(PROTOCOL_VIOLATION);
+ UnregisterApplication(navi_app_to_stop_, ABORTED);
+ }
+}
+
+bool ApplicationManagerImpl::AckReceived(protocol_handler::ServiceType type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace protocol_handler;
+
+ const bool sent = service_status_[type].first;
+ const bool received = service_status_[type].second;
+
+ LOG4CXX_DEBUG(logger_, "Ack for services type " << type
+ << " is send: " << sent
+ << " is received: " << received);
+
+ return sent == received;
+}
+
+void ApplicationManagerImpl::NaviAppChangeLevel(mobile_apis::HMILevel::eType new_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ if (new_level == HMILevel::HMI_BACKGROUND) {
+ end_services_timer.start(wait_end_service_timeout_, this, &ApplicationManagerImpl::EndNaviServices);
+ } else if (new_level == HMILevel::HMI_NONE) {
+ EndNaviServices();
+ LOG4CXX_DEBUG(logger_, "Send end services start close app timer");
+ end_services_timer.start(wait_end_service_timeout_, this, &ApplicationManagerImpl::CloseNaviApp);
+ } else {
+ LOG4CXX_DEBUG(logger_, "There is no defined behavior for hmi " <<
+ "levels that are differen from NONE or BACKGROUND");
+ }
+}
+
+void ApplicationManagerImpl::OnWakeUp() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_low_voltage_ = false;
+ request_ctrl_.OnWakeUp();
+}
+
void ApplicationManagerImpl::Mute(VRTTSSessionChanging changing_state) {
mobile_apis::AudioStreamingState::eType state =
- hmi_capabilities_.attenuated_supported()
- ? mobile_apis::AudioStreamingState::ATTENUATED
- : mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+
+ // ATTENUATED state applicable only for TTS
+ if ((kTTSSessionChanging == changing_state) &&
+ hmi_capabilities_.attenuated_supported()) {
+ state = mobile_apis::AudioStreamingState::ATTENUATED;
+ }
+
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::TAppList local_app_list = accessor.applications();
- ApplicationManagerImpl::TAppListConstIt it = local_app_list.begin();
- ApplicationManagerImpl::TAppListConstIt itEnd = local_app_list.end();
+ ApplicationManagerImpl::ApplictionSetConstIt it =
+ accessor.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt
+ itEnd = accessor.end();
for (; it != itEnd; ++it) {
if ((*it).valid()) {
if ((*it)->is_media_application()) {
@@ -2230,9 +2504,8 @@ void ApplicationManagerImpl::Mute(VRTTSSessionChanging changing_state) {
void ApplicationManagerImpl::Unmute(VRTTSSessionChanging changing_state) {
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::TAppList local_app_list = application_list_;
- ApplicationManagerImpl::TAppListConstIt it = local_app_list.begin();
- ApplicationManagerImpl::TAppListConstIt itEnd = local_app_list.end();
+ ApplicationManagerImpl::ApplictionSetConstIt it = accessor.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt itEnd = accessor.end();
for (; it != itEnd; ++it) {
if ((*it).valid()) {
@@ -2332,19 +2605,8 @@ bool ApplicationManagerImpl::IsHMICooperating() const {
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
LOG4CXX_DEBUG(logger_, "Application list update timer finished");
-
- std::list <uint32_t> applications_ids;
-
- applications_list_lock_.Acquire();
- for (std::set<ApplicationSharedPtr>::const_iterator i = application_list_.begin();
- i != application_list_.end(); ++i) {
- ApplicationSharedPtr application = *i;
- uint32_t app_id = application->app_id();
- applications_ids.push_back(app_id);
- }
- applications_list_lock_.Release();
-
- SendUpdateAppList(applications_ids);
+ SendUpdateAppList();
+ policy::PolicyHandler::instance()->OnAppsSearchCompleted();
}
void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
@@ -2375,11 +2637,12 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
const uint32_t app_id) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList");
+ LOG4CXX_AUTO_TRACE(logger_);
uint16_t timeout = profile::Profile::instance()->tts_global_properties_timeout();
TimevalStruct current_time = date_time::DateTime::getCurrentTime();
current_time.tv_sec += timeout;
- sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ // please avoid AutoLock usage to avoid deadlock
+ tts_global_properties_app_list_lock_.Acquire();
if (tts_global_properties_app_list_.end() ==
tts_global_properties_app_list_.find(app_id)) {
tts_global_properties_app_list_[app_id] = current_time;
@@ -2387,38 +2650,45 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
//if add first item need to start timer on one second
if (1 == tts_global_properties_app_list_.size()) {
LOG4CXX_INFO(logger_, "Start tts_global_properties_timer_");
+ tts_global_properties_app_list_lock_.Release();
tts_global_properties_timer_.start(1);
+ return;
}
+ tts_global_properties_app_list_lock_.Release();
}
void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
const uint32_t app_id) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList");
- sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ // please avoid AutoLock usage to avoid deadlock
+ tts_global_properties_app_list_lock_.Acquire();
std::map<uint32_t, TimevalStruct>::iterator it =
tts_global_properties_app_list_.find(app_id);
if (tts_global_properties_app_list_.end() != it) {
tts_global_properties_app_list_.erase(it);
- if (!(tts_global_properties_app_list_.size())) {
+ if (tts_global_properties_app_list_.empty()) {
LOG4CXX_INFO(logger_, "Stop tts_global_properties_timer_");
- //if container is empty need to stop timer
- tts_global_properties_timer_.stop();
+ // if container is empty need to stop timer
+ tts_global_properties_app_list_lock_.Release();
+ tts_global_properties_timer_.pause();
+ return;
}
}
+ tts_global_properties_app_list_lock_.Release();
}
void ApplicationManagerImpl::CreatePhoneCallAppList() {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::TAppList local_app_list = accessor.applications();
- ApplicationManagerImpl::TAppListIt it = local_app_list.begin();
- ApplicationManagerImpl::TAppListIt itEnd = local_app_list.end();
+ ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationManagerImpl::ApplictionSetIt itEnd = accessor.end();
+ using namespace mobile_apis::HMILevel;
+ using namespace helpers;
for (; it != itEnd; ++it) {
- if (mobile_api::HMILevel::HMI_FULL == (*it)->hmi_level() ||
- mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level()) {
+ if (Compare<eType, EQ, ONE>((*it)->hmi_level(), HMI_FULL, HMI_LIMITED)) {
// back up app state
on_phone_call_app_list_.insert(std::pair<uint32_t, AppState>(
@@ -2426,8 +2696,9 @@ void ApplicationManagerImpl::CreatePhoneCallAppList() {
(*it)->audio_streaming_state(),
(*it)->system_context())));
+ ChangeAppsHMILevel((*it)->app_id() , (*it)->is_navi() ? HMI_LIMITED : HMI_BACKGROUND);
+
// app state during phone call
- (*it)->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
(*it)->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE);
(*it)->set_system_context(mobile_api::SystemContext::SYSCTXT_MAIN);
MessageHelper::SendHMIStatusNotification(*(*it));
@@ -2436,10 +2707,7 @@ void ApplicationManagerImpl::CreatePhoneCallAppList() {
}
void ApplicationManagerImpl::ResetPhoneCallAppList() {
- LOG4CXX_TRACE_ENTER(logger_);
-
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::TAppList local_app_list = accessor.applications();
+ LOG4CXX_AUTO_TRACE(logger_);
std::map<uint32_t, AppState>::iterator it =
on_phone_call_app_list_.begin();
@@ -2448,7 +2716,8 @@ void ApplicationManagerImpl::ResetPhoneCallAppList() {
for (; it != it_end; ++it) {
ApplicationSharedPtr app = application(it->first);
if (app) {
- app->set_hmi_level(it->second.hmi_level);
+ ChangeAppsHMILevel(app->app_id(), it->second.hmi_level);
+
app->set_audio_streaming_state(it->second.audio_streaming_state);
app->set_system_context(it->second.system_context);
MessageHelper::SendHMIStatusNotification(*app);
@@ -2458,4 +2727,191 @@ void ApplicationManagerImpl::ResetPhoneCallAppList() {
on_phone_call_app_list_.clear();
}
+void ApplicationManagerImpl::ChangeAppsHMILevel(uint32_t app_id,
+ mobile_apis::HMILevel::eType level) {
+ using namespace mobile_apis::HMILevel;
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "AppID to change: " << app_id << " -> "
+ << level);
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "There is no app with id: " << app_id);
+ return;
+ }
+ eType old_level = app->hmi_level();
+ if (old_level != level) {
+ app->set_hmi_level(level);
+ OnHMILevelChanged(app_id, old_level, level);
+ } else {
+ LOG4CXX_WARN(logger_, "Redudant changing HMI level : " << level);
+ }
+
+}
+
+void ApplicationManagerImpl::MakeAppNotAudible(uint32_t app_id) {
+ using namespace mobile_apis;
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "There is no app with id: " << app_id);
+ return;
+ }
+ ChangeAppsHMILevel(app_id, HMILevel::HMI_BACKGROUND);
+ app->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE);
+}
+
+bool ApplicationManagerImpl::MakeAppFullScreen(uint32_t app_id) {
+ using namespace mobile_apis;
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "There is no app with id: " << app_id);
+ return false;
+ }
+
+ ChangeAppsHMILevel(app_id, HMILevel::HMI_FULL);
+ if (app->is_media_application() || app->is_navi()) {
+ app->set_audio_streaming_state(AudioStreamingState::AUDIBLE);
+ }
+ app->set_system_context(SystemContext::SYSCTXT_MAIN);
+
+ if(!app->has_been_activated()) {
+ app->set_activated(true);
+ }
+
+ return true;
+}
+
+
+mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType(std::string str) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if ("DEFAULT" == str) {
+ return mobile_apis::AppHMIType::DEFAULT;
+ } else if ("COMMUNICATION" == str) {
+ return mobile_apis::AppHMIType::COMMUNICATION;
+ } else if ("MEDIA" == str) {
+ return mobile_apis::AppHMIType::MEDIA;
+ } else if ("MESSAGING" == str) {
+ return mobile_apis::AppHMIType::MESSAGING;
+ } else if ("NAVIGATION" == str) {
+ return mobile_apis::AppHMIType::NAVIGATION;
+ } else if ("INFORMATION" == str) {
+ return mobile_apis::AppHMIType::INFORMATION;
+ } else if ("SOCIAL" == str) {
+ return mobile_apis::AppHMIType::SOCIAL;
+ } else if ("BACKGROUND_PROCESS" == str) {
+ return mobile_apis::AppHMIType::BACKGROUND_PROCESS;
+ } else if ("TESTING" == str) {
+ return mobile_apis::AppHMIType::TESTING;
+ } else if ("SYSTEM" == str) {
+ return mobile_apis::AppHMIType::SYSTEM;
+ } else {
+ return mobile_apis::AppHMIType::INVALID_ENUM;
+ }
+}
+
+bool ApplicationManagerImpl::CompareAppHMIType (const smart_objects::SmartObject& from_policy,
+ const smart_objects::SmartObject& from_application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool equal = false;
+ uint32_t lenght_policy_app_types = from_policy.length();
+ uint32_t lenght_application_app_types = from_application.length();
+
+ for(uint32_t i = 0; i < lenght_application_app_types; ++i) {
+ for(uint32_t k = 0; k < lenght_policy_app_types; ++k) {
+ if (from_application[i] == from_policy[k]) {
+ equal = true;
+ break;
+ }
+ }
+ if(!equal) {
+ return false;
+ }
+ equal = false;
+ }
+ return true;
+}
+
+void ApplicationManagerImpl::OnUpdateHMIAppType(
+ std::map<std::string, std::vector<std::string> > app_hmi_types) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::map<std::string, std::vector<std::string> >::iterator it_app_hmi_types_from_policy;
+ std::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()));
+
+ if (it_app_hmi_types_from_policy != app_hmi_types.end() &&
+ ((it_app_hmi_types_from_policy->second).size())) {
+ flag_diffirence_app_hmi_type = false;
+ hmi_types_from_policy = (it_app_hmi_types_from_policy->second);
+
+ if(transform_app_hmi_types.length()) {
+ transform_app_hmi_types =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ }
+
+ for(uint32_t i = 0; i < hmi_types_from_policy.size(); ++i) {
+ transform_app_hmi_types[i] = StringToAppHMIType(hmi_types_from_policy[i]);
+ }
+
+ ApplicationConstSharedPtr app = *it;
+ const smart_objects::SmartObject* save_application_hmi_type = app->app_types();
+
+ if (save_application_hmi_type == NULL ||
+ ((*save_application_hmi_type).length() != transform_app_hmi_types.length())) {
+ flag_diffirence_app_hmi_type = true;
+ } else {
+ flag_diffirence_app_hmi_type = !(CompareAppHMIType(transform_app_hmi_types,
+ *save_application_hmi_type));
+ }
+
+ if (flag_diffirence_app_hmi_type) {
+ (*it)->set_app_types(transform_app_hmi_types);
+ (*it)->ChangeSupportingAppHMIType();
+ if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
+
+ MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
+ } else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
+ ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
+
+ MessageHelper::SendActivateAppToHMI((*it)->app_id(),
+ hmi_apis::Common_HMILevel::BACKGROUND,
+ false);
+ MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
+ ChangeAppsHMILevel((*it)->app_id(), mobile_api::HMILevel::HMI_BACKGROUND);
+ MessageHelper::SendHMIStatusNotification(*(*it));
+ }
+ }
+ }
+ }
+}
+
+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();
+
+ if (sdl4_support) {
+ 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);
+ return ProtocolVersion::kV3;
+ }
+
+ LOG4CXX_DEBUG(logger_, "SDL Supported protocol version "<<ProtocolVersion::kV2);
+ return ProtocolVersion::kV2;
+}
+
+
+ApplicationManagerImpl::ApplicationListAccessor::~ApplicationListAccessor() {
+}
+
} // 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 86b764c46a..66c0e2c631 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -1,4 +1,4 @@
-/**
+/*
Copyright (c) 2014, Ford Motor Company
All rights reserved.
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
new file mode 100644
index 0000000000..ee7afaddf9
--- /dev/null
+++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
@@ -0,0 +1,74 @@
+/*
+ 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/command_notification_from_mobile_impl.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/message_helper.h"
+
+namespace application_manager {
+
+namespace commands {
+
+CommandNotificationFromMobileImpl::CommandNotificationFromMobileImpl(
+ const MessageSharedPtr& message)
+ : CommandImpl(message) {
+}
+
+CommandNotificationFromMobileImpl::~CommandNotificationFromMobileImpl() {
+}
+
+bool CommandNotificationFromMobileImpl::Init() {
+ return true;
+}
+
+bool CommandNotificationFromMobileImpl::CleanUp() {
+ return true;
+}
+
+void CommandNotificationFromMobileImpl::Run() {
+}
+
+void CommandNotificationFromMobileImpl::SendNotification() {
+ (*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
+ (*message_)[strings::params][strings::protocol_version] = protocol_version_;
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+
+ LOG4CXX_INFO(logger_, "SendNotification");
+ MessageHelper::PrintSmartObject(*message_);
+
+ ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 5f8757754f..5d70e15722 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -53,12 +53,12 @@ struct DisallowedParamsInserter {
application_manager::MessageHelper::vehicle_data();
VehicleData::const_iterator it = vehicle_data.find(param);
if (vehicle_data.end() != it) {
- smart_objects::SmartObject* disallowed_param =
+ smart_objects::SmartObjectSPtr disallowed_param =
new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*disallowed_param)[strings::data_type] = (*it).second;
(*disallowed_param)[strings::result_code] = code_;
- response_[strings::msg_params][param.c_str()] = *disallowed_param;
- return true;
+ response_[strings::msg_params][param.c_str()] = *disallowed_param;
+ return true;
}
return false;
}
@@ -75,7 +75,7 @@ CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message)
CommandRequestImpl::~CommandRequestImpl() {
}
-bool CommandRequestImpl::Init() {
+bool CommandRequestImpl::Init() {
return true;
}
@@ -91,12 +91,14 @@ void CommandRequestImpl::Run() {
}
void CommandRequestImpl::onTimeOut() {
- LOG4CXX_INFO(logger_, "CommandRequestImpl::onTimeOut");
+ LOG4CXX_AUTO_TRACE(logger_);
unsubscribe_from_all_events();
{
+ // FIXME (dchmerev@luxoft.com): atomic_xchg fits better
sync_primitives::AutoLock auto_lock(state_lock_);
if (kCompleted == current_state_) {
+ LOG4CXX_DEBUG(logger_, "current_state_ = kCompleted");
// don't send timeout if request completed
return;
}
@@ -104,7 +106,7 @@ void CommandRequestImpl::onTimeOut() {
current_state_ = kTimedOut;
}
- smart_objects::SmartObject* response =
+ smart_objects::SmartObjectSPtr response =
MessageHelper::CreateNegativeResponse(connection_key(), function_id(),
correlation_id(), mobile_api::Result::GENERIC_ERROR);
@@ -116,7 +118,7 @@ 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 NsSmart::SmartObject* response_params) {
+ const char* info, const smart_objects::SmartObject* response_params) {
{
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -128,13 +130,12 @@ void CommandRequestImpl::SendResponse(
current_state_ = kCompleted;
}
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
}
- NsSmartDeviceLink::NsSmartObjects::SmartObject& response = *result;
+ smart_objects::SmartObject& response = *result;
response[strings::params][strings::message_type] = MessageType::kResponse;
response[strings::params][strings::correlation_id] = correlation_id();
@@ -193,10 +194,9 @@ bool CommandRequestImpl::CheckSyntax(std::string str, bool allow_empty_line) {
void CommandRequestImpl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
- const NsSmart::SmartObject* msg_params, bool use_events) {
+ const smart_objects::SmartObject* msg_params, bool use_events) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
@@ -205,11 +205,11 @@ void CommandRequestImpl::SendHMIRequest(
const uint32_t hmi_correlation_id =
ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
if (use_events) {
- LOG4CXX_WARN(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);
}
- NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
+ smart_objects::SmartObject& request = *result;
request[strings::params][strings::message_type] = MessageType::kRequest;
request[strings::params][strings::function_id] = function_id;
request[strings::params][strings::correlation_id] = hmi_correlation_id;
@@ -232,13 +232,12 @@ void CommandRequestImpl::CreateHMINotification(
const hmi_apis::FunctionID::eType& function_id,
const NsSmart::SmartObject& msg_params) const {
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
}
- NsSmartDeviceLink::NsSmartObjects::SmartObject& notify = *result;
+ smart_objects::SmartObject& notify = *result;
notify[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
@@ -369,11 +368,11 @@ bool CommandRequestImpl::CheckAllowedParameters() {
return true;
}
- typedef std::set<application_manager::ApplicationSharedPtr> ApplicationList;
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationList app_list = accessor.applications();
- ApplicationList::const_iterator it_app_list = app_list.begin();
- ApplicationList::const_iterator it_app_list_end = app_list.end();
+ ApplicationManagerImpl::ApplictionSetConstIt it_app_list =
+ accessor.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt 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()) {
@@ -385,7 +384,10 @@ bool CommandRequestImpl::CheckAllowedParameters() {
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
for (; iter != iter_end; ++iter) {
- params.push_back(iter->first);
+ if (true == iter->second.asBool()) {
+ LOG4CXX_INFO(logger_, "Request's param: " << iter->first);
+ params.push_back(iter->first);
+ }
}
}
@@ -393,7 +395,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
mobile_apis::Result::eType check_result =
application_manager::ApplicationManagerImpl::instance()->
CheckPolicyPermissions(
- (*it_app_list).get()->mobile_app_id()->asString(),
+ (*it_app_list).get()->mobile_app_id(),
(*it_app_list).get()->hmi_level(),
static_cast<mobile_api::FunctionID::eType>(function_id()),
params,
@@ -401,7 +403,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
// Check, if RPC is allowed by policy
if (mobile_apis::Result::SUCCESS != check_result) {
- smart_objects::SmartObject* response =
+ smart_objects::SmartObjectSPtr response =
MessageHelper::CreateBlockedByPoliciesResponse(
static_cast<mobile_api::FunctionID::eType>(function_id()),
check_result, correlation_id(), (*it_app_list)->app_id());
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 29d998640e..4b07a5dcfa 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -69,11 +69,11 @@ namespace application_manager {
void ActivateAppRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_TRACE_ENTER(logger_);
- const smart_objects::SmartObject* response = &(event.smart_object());
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& response = event.smart_object();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
- (*response)[strings::params][hmi_response::code].asInt());
+ response[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS != code) {
LOG4CXX_ERROR(logger_, "Error ActivateApp result code " << code);
return;
@@ -82,8 +82,15 @@ namespace application_manager {
// Mobile id is converted to HMI id for HMI requests
const uint32_t hmi_app_id = ApplicationManagerImpl::instance()->
application_id(correlation_id);
- mobile_apis::HMILevel::eType requested_hmi_level = static_cast<mobile_apis::HMILevel::eType>(
- (*message_)[strings::msg_params][strings::activate_app_hmi_level].asInt());
+
+ mobile_apis::HMILevel::eType requested_hmi_level = mobile_apis::HMILevel::HMI_FULL;
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::activate_app_hmi_level)) {
+ requested_hmi_level = static_cast<mobile_apis::HMILevel::eType>(
+ (*message_)[strings::msg_params][strings::activate_app_hmi_level].asInt());
+ LOG4CXX_INFO(logger_, "requested_hmi_level = " << requested_hmi_level);
+ }
+
if (0 == hmi_app_id) {
LOG4CXX_ERROR(logger_, "Error hmi_app_id = "<< hmi_app_id);
return;
@@ -95,8 +102,10 @@ namespace application_manager {
LOG4CXX_ERROR(logger_, "Application can't be activated.");
return;
}
+
if (mobile_apis::HMILevel::HMI_FULL == requested_hmi_level) {
if (ApplicationManagerImpl::instance()->ActivateApplication(application)) {
+ LOG4CXX_DEBUG(logger_, "Put Application in FULL succes");
MessageHelper::SendHMIStatusNotification(*(application.get()));
}
}
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 aba5886097..2f63198d82 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 c11621045e..73c9a49def 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {
}
void AddStatisticsInfoNotification::Run() {
- LOG4CXX_INFO(logger_, "AddStatisticsInfoNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
int type = (*message_)[strings::msg_params][hmi_notification::statistic_type]
.asInt();
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 6ac42c7a00..548238f00f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ AllowAllAppsRequest::~AllowAllAppsRequest() {
}
void AllowAllAppsRequest::Run() {
- LOG4CXX_INFO(logger_, "AllowAllAppsRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 69c52a3269..eca9363254 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ AllowAllAppsResponse::~AllowAllAppsResponse() {
}
void AllowAllAppsResponse::Run() {
- LOG4CXX_INFO(logger_, "AllowAllAppsResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->set_all_apps_allowed(
(*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 302a8c6766..2f0d4bcc98 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ AllowAppRequest::~AllowAppRequest() {
}
void AllowAppRequest::Run() {
- LOG4CXX_INFO(logger_, "AllowAppRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 035e41438d..7a7f3dd560 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ AllowAppResponse::~AllowAppResponse() {
}
void AllowAppResponse::Run() {
- LOG4CXX_INFO(logger_, "AllowAppResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_key =
(*message_)[strings::params][strings::connection_key].asInt();
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 0d2bcca4f4..d0251a7276 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {
}
void BasicCommunicationSystemRequest::Run() {
- LOG4CXX_INFO(logger_, "BasicCommunicationSystemRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 dd9f657adc..6106266d19 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {
}
void BasicCommunicationSystemResponse::Run() {
- LOG4CXX_INFO(logger_, "BasicCommunicationSystemResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_SystemRequest);
event.set_smart_object(*message_);
event.raise();
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 e00b3fdc5a..87cf1aa783 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {
}
void ButtonGetCapabilitiesRequest::Run() {
- LOG4CXX_INFO(logger_, "ButtonGetCapabilitiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 0b67234743..69cfbe49c5 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {
}
void ButtonGetCapabilitiesResponse::Run() {
- LOG4CXX_INFO(logger_, "ButtonGetCapabilitiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_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 3cc5818688..352a281348 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ ClosePopupRequest::~ClosePopupRequest() {
}
void ClosePopupRequest::Run() {
- LOG4CXX_INFO(logger_, "ClosePopupRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 fa98be5e02..078d24ef2d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -43,7 +43,7 @@ ClosePopupResponse::~ClosePopupResponse() {
}
void ClosePopupResponse::Run() {
- LOG4CXX_INFO(logger_, "ClosePopupResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(VS): Process response from HMI
}
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 53a084d23e..9024331462 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ GetSystemInfoRequest::~GetSystemInfoRequest() {
}
void GetSystemInfoRequest::Run() {
- LOG4CXX_INFO(logger_, "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);
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 090b04c3e3..7cfd1b5797 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ GetSystemInfoResponse::~GetSystemInfoResponse() {
}
void GetSystemInfoResponse::Run() {
- LOG4CXX_INFO(logger_, "GetSystemInfoResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
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 b3d0f60610..70ca40d1ed 100644
--- a/src/components/application_manager/src/commands/hmi/get_urls.cc
+++ b/src/components/application_manager/src/commands/hmi/get_urls.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,27 +46,48 @@ GetUrls::~GetUrls() {
}
void GetUrls::Run() {
- LOG4CXX_INFO(logger_, "GetUrls::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
object[strings::params][strings::message_type] = MessageType::kResponse;
if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- policy::EndpointUrls endpoints =
- policy::PolicyHandler::instance()->GetUpdateUrls(
- object[strings::msg_params][hmi_request::service].asInt());
- object[strings::msg_params].erase(hmi_request::service);
- object[strings::msg_params][hmi_response::urls] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- for (size_t i = 0; i < endpoints.size(); ++i) {
- std::string url = endpoints[i].url.empty() ? "" : endpoints[i].url[0];
- object[strings::msg_params][hmi_response::urls][i][strings::url] = url;
- if (policy::kDefaultId != endpoints[i].app_id) {
- object[strings::msg_params][hmi_response::urls][i][hmi_response::policy_app_id] =
- endpoints[i].app_id;
+ policy::EndpointUrls endpoints;
+ policy::PolicyHandler::instance()->GetUpdateUrls(
+ object[strings::msg_params][hmi_request::service].asInt(), endpoints);
+ if (!endpoints.empty()) {
+ object[strings::msg_params].erase(hmi_request::service);
+
+ object[strings::msg_params][hmi_response::urls] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject& urls =
+ object[strings::msg_params][hmi_response::urls];
+
+ size_t index = 0;
+
+ for (size_t i = 0; i < endpoints.size(); ++i) {
+ for (size_t k = 0; k < endpoints[i].url.size(); ++k, ++index) {
+ const std::string url = endpoints[i].url[k];
+
+ urls[index] = smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject& service_info = urls[index];
+
+ service_info[strings::url] = url;
+ if (policy::kDefaultId != endpoints[i].app_id) {
+ service_info[hmi_response::policy_app_id] =
+ endpoints[i].app_id;
+ }
+ }
}
+ object[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ } else {
+ object[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
}
- object[strings::params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
} else {
- object[strings::params][hmi_response::code] = hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+ object[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
}
ApplicationManagerImpl::instance()->ManageHMICommand(message_);
}
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 f8086affe3..b446f088bf 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ GetUrlsResponse::~GetUrlsResponse() {
}
void GetUrlsResponse::Run() {
- LOG4CXX_INFO(logger_, "GetUrlsResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 9ab4bf5dbb..059843355c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {
}
void MixingAudioSupportedRequest::Run() {
- LOG4CXX_INFO(logger_, "MixingAudioSupportedRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 4a4fc276de..2da8bdc453 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {
}
void MixingAudioSupportedResponse::Run() {
- LOG4CXX_INFO(logger_, "MixingAudioSupportedResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 7128231b11..77b3701904 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {
}
void NaviAlertManeuverRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviAlertManeuverRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 823c96211e..49d659777b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {
}
void NaviAlertManeuverResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviAlertManeuverResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver);
event.set_smart_object(*message_);
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 3c7a7d3ab5..3908238ada 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ AudioStartStreamRequest::~AudioStartStreamRequest() {
}
void AudioStartStreamRequest::Run() {
- LOG4CXX_INFO(logger_, "AudioStartStreamRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 e4cc8f4cc6..0509028a94 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ AudioStartStreamResponse::~AudioStartStreamResponse() {
}
void AudioStartStreamResponse::Run() {
- LOG4CXX_INFO(logger_, "AudioStartStreamResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->active_application();
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 4052769d53..ea00d5bc3b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ AudioStopStreamRequest::~AudioStopStreamRequest() {
}
void AudioStopStreamRequest::Run() {
- LOG4CXX_INFO(logger_, "AudioStopStreamRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 81a6c62e8d..29e6708e19 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -43,7 +43,7 @@ AudioStopStreamResponse::~AudioStopStreamResponse() {
}
void AudioStopStreamResponse::Run() {
- LOG4CXX_INFO(logger_, "AudioStopStreamResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
}
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 b7a1799427..4c00908781 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviIsReadyRequest::~NaviIsReadyRequest() {
}
void NaviIsReadyRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviIsReadyRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 8aef42b40d..a3387aec33 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviIsReadyResponse::~NaviIsReadyResponse() {
}
void NaviIsReadyResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviIsReadyResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
bool is_available = false;
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 f396a24323..94d569c4ef 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviSendLocationRequest::~NaviSendLocationRequest() {
}
void NaviSendLocationRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviSendLocationRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 944ced170c..7ec5a5907d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviSendLocationResponse::~NaviSendLocationResponse() {
}
void NaviSendLocationResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviSendLocationResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation);
event.set_smart_object(*message_);
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 9103e1f6c4..b477dc8dab 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {
}
void NaviShowConstantTBTRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviShowConstantTBTRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 03c70dd81b..58878a3c0c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {
}
void NaviShowConstantTBTResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviShowConstantTBTResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT);
event.set_smart_object(*message_);
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 cb9dbd61e3..7ee3733e51 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ NaviStartStreamRequest::~NaviStartStreamRequest() {
}
void NaviStartStreamRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviStartStreamRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 79d51dcb66..c2de690d63 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ NaviStartStreamResponse::~NaviStartStreamResponse() {
}
void NaviStartStreamResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviStartStreamResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->active_application();
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 2f1e14a122..3d74c27535 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
@@ -13,7 +13,7 @@ NaviStopStreamRequest::~NaviStopStreamRequest() {
}
void NaviStopStreamRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviStopStreamRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 c368940d5b..0603df6a65 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -43,7 +43,7 @@ NaviStopStreamResponse::~NaviStopStreamResponse() {
}
void NaviStopStreamResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviStopStreamResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
}
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 d0df9ec867..37037245fa 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {
}
void NaviUpdateTurnListRequest::Run() {
- LOG4CXX_INFO(logger_, "NaviUpdateTurnListRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 d93b67bb52..d196db93e9 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {
}
void NaviUpdateTurnListResponse::Run() {
- LOG4CXX_INFO(logger_, "NaviUpdateTurnListResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*message_);
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 2b7ec13c43..9c483459e1 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
@@ -42,7 +42,7 @@ NotificationFromHMI::NotificationFromHMI(const MessageSharedPtr& message)
: CommandImpl(message) {
// Replace HMI app id with Mobile connection id
- ApplicationManagerImpl::instance()->ReplaceHMIByMobileAppId(*(message.get()));
+ ApplicationManagerImpl::instance()->ReplaceHMIByMobileAppId(*message);
}
NotificationFromHMI::~NotificationFromHMI() {
@@ -61,15 +61,17 @@ 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);
}
void NotificationFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
- const NsSmartObj::SmartObject& msg_params) const {
+ const smart_objects::SmartObject& msg_params) const {
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
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 020428d6c0..506413ce1e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {
}
void OnAllowSDLFunctionalityNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAllowSDLFunctionalityNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t device_id = 0;
if ((*message_)[strings::msg_params].keyExists("device")) {
device_id = (*message_)[strings::msg_params]["device"]["id"].asUInt();
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 8152244a9c..7e60eaadaf 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -48,7 +48,7 @@ OnAppActivatedNotification::~OnAppActivatedNotification() {
}
void OnAppActivatedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppActivatedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = ((*message_)[strings::msg_params][strings::app_id]).asUInt();
MessageHelper::SendActivateAppToHMI(app_id);
}
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 19dd91ab2a..1d55044f7a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -35,6 +35,7 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "config_profile/profile.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -49,7 +50,7 @@ OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {
}
void OnAppDeactivatedNotification::Run() {
- LOG4CXX_INFO(logger_, "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);
@@ -58,11 +59,13 @@ void OnAppDeactivatedNotification::Run() {
return;
}
+ using namespace mobile_apis::HMILevel;
+ using namespace helpers;
if (!(((hmi_apis::Common_DeactivateReason::AUDIO ==
(*message_)[strings::msg_params][hmi_request::reason].asInt()) ||
(hmi_apis::Common_DeactivateReason::PHONECALL ==
(*message_)[strings::msg_params][hmi_request::reason].asInt())) &&
- (app->hmi_level() == mobile_api::HMILevel::eType::HMI_LIMITED))) {
+ (app->hmi_level() == HMI_LIMITED))) {
app = ApplicationManagerImpl::instance()->active_application();
if (!app.valid()) {
LOG4CXX_ERROR_EXT(logger_, "OnAppDeactivatedNotification no active app!");
@@ -74,10 +77,11 @@ void OnAppDeactivatedNotification::Run() {
}
}
- if (mobile_api::HMILevel::eType::HMI_NONE == app->hmi_level()) {
+ if (HMI_NONE == app->hmi_level()) {
return;
}
+ eType new_hmi_level = app->hmi_level();
switch ((*message_)[strings::msg_params][hmi_request::reason].asInt()) {
case hmi_apis::Common_DeactivateReason::AUDIO: {
if (app->is_media_application()) {
@@ -89,29 +93,14 @@ void OnAppDeactivatedNotification::Run() {
app->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE);
}
}
- // switch HMI level for all applications in FULL or LIMITED
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::TAppList applications =
- accessor.applications();
- ApplicationManagerImpl::TAppListIt it =
- applications.begin();
- for (; applications.end() != it; ++it) {
- ApplicationSharedPtr app = *it;
- if (app.valid()) {
- if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level() ||
- mobile_apis::HMILevel::eType::HMI_LIMITED == app->hmi_level()) {
- app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
- MessageHelper::SendHMIStatusNotification(*app);
- }
- }
+ // HMI must send this notification for each active app
+ if (app.valid()) {
+ if (Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED)) {
+ new_hmi_level = HMI_BACKGROUND;
+ }
}
break;
}
- case hmi_apis::Common_DeactivateReason::PHONECALL: {
- app->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE);
- app->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:
@@ -119,9 +108,9 @@ void OnAppDeactivatedNotification::Run() {
if ((!app->IsAudioApplication()) ||
ApplicationManagerImpl::instance()->
DoesAudioAppWithSameHMITypeExistInFullOrLimited(app)) {
- app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
+ new_hmi_level = HMI_BACKGROUND;
} else {
- app->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED);
+ new_hmi_level = HMI_LIMITED;
}
break;
}
@@ -131,7 +120,11 @@ void OnAppDeactivatedNotification::Run() {
}
}
- MessageHelper::SendHMIStatusNotification(*app);
+ if (new_hmi_level != app->hmi_level()) {
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ new_hmi_level);
+ MessageHelper::SendHMIStatusNotification(*app);
+ }
}
} // namespace commands
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 26d580e83a..c786b486f4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {
}
void OnAppPermissionChangedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppPermissionChangedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 951a2ebdf1..69a18200fa 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
@@ -48,7 +48,7 @@ OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {
}
void OnAppPermissionConsentNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppPermissionConsentNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
uint32_t connection_key = 0;
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 26bc396db6..0b7f1cd860 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,8 +45,10 @@ OnAppRegisteredNotification::~OnAppRegisteredNotification() {
}
void OnAppRegisteredNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppRegisteredNotification::Run");
-
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
+ event.set_smart_object(*message_);
+ event.raise();
SendNotification();
}
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 2bedcb0631..571c6f381c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {
}
void OnAppUnregisteredNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppUnregisteredNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
//sending event for delete VRCommand on PerformInteraction
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered);
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 23aceaa7d6..2beffc2bdd 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnButtonEventNotification::OnButtonEventNotification(
}
void OnButtonEventNotification::Run() {
- LOG4CXX_INFO(logger_, "OnButtonEventNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnButtonEventID);
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 83bcbd7efa..261aa68ee7 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnButtonPressNotification::OnButtonPressNotification(
}
void OnButtonPressNotification::Run() {
- LOG4CXX_INFO(logger_, "OnButtonPressNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress);
event.set_smart_object(*message_);
event.raise();
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 537c246f42..5d73c7b80e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnDeviceChosenNotification::~OnDeviceChosenNotification() {
}
void OnDeviceChosenNotification::Run() {
- LOG4CXX_INFO(logger_, "OnDeviceChosenNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
if ((*message_)[strings::msg_params].keyExists(strings::device_info)) {
ApplicationManagerImpl::instance()->ConnectToDevice(
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 8af2571b55..fbb2bcfe93 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -30,10 +30,47 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
#include "application_manager/commands/hmi/on_device_state_changed_notification.h"
#include "application_manager/policies/policy_handler.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);
+
+ 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 {
@@ -48,10 +85,12 @@ OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {
}
void OnDeviceStateChangedNotification::Run() {
- LOG4CXX_INFO(logger_, "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 (device_id.empty()) {
@@ -59,6 +98,13 @@ void OnDeviceStateChangedNotification::Run() {
device_id = MessageHelper::GetDeviceMacAddressForHandle(
(*message_)[strings::msg_params]["deviceId"]["id"].asInt());
}
+ } 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::PolicyHandler::instance()->RemoveDevice(device_id);
}
@@ -67,4 +113,3 @@ void OnDeviceStateChangedNotification::Run() {
} // namespace commands
} // namespace application_manager
-
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 d5a8edc48d..fc9dcc6f8e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -52,7 +52,7 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {
}
void OnDriverDistractionNotification::Run() {
- LOG4CXX_INFO(logger_, "OnDriverDistractionNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_DriverDistractionState::eType state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
@@ -60,10 +60,10 @@ void OnDriverDistractionNotification::Run() {
.asInt());
ApplicationManagerImpl::instance()->set_driver_distraction(state);
- MessageSharedPtr on_driver_distraction =
+ smart_objects::SmartObjectSPtr on_driver_distraction =
new smart_objects::SmartObject();
- if (false == on_driver_distraction.valid()) {
+ if (!on_driver_distraction) {
LOG4CXX_ERROR_EXT(logger_, "NULL pointer");
return;
}
@@ -75,12 +75,12 @@ void OnDriverDistractionNotification::Run() {
state;
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
+ const ApplicationManagerImpl::ApplictionSet applications = accessor.applications();
- std::set<ApplicationSharedPtr>::const_iterator it = applications.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt it = applications.begin();
for (; applications.end() != it; ++it) {
- ApplicationSharedPtr app = *it;
- if (app.valid()) {
+ const ApplicationSharedPtr app = *it;
+ if (app) {
if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) {
(*on_driver_distraction)[strings::params]
[strings::connection_key] = app->app_id();
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 b284c81f21..7c09800d21 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
@@ -52,11 +52,12 @@ OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {
}
void OnExitAllApplicationsNotification::Run() {
- LOG4CXX_INFO(logger_, "OnExitAllApplicationsNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_ApplicationsCloseReason::eType reason =
static_cast<hmi_apis::Common_ApplicationsCloseReason::eType>(
(*message_)[strings::msg_params][hmi_request::reason].asInt());
+ LOG4CXX_DEBUG(logger_, "Reason " << reason);
mobile_api::AppInterfaceUnregisteredReason::eType mob_reason =
mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM;
@@ -77,7 +78,6 @@ void OnExitAllApplicationsNotification::Run() {
break;
}
case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: {
- app_manager->HeadUnitSuspend();
SendOnSDLPersistenceComplete();
return;
}
@@ -93,15 +93,13 @@ void OnExitAllApplicationsNotification::Run() {
mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS == mob_reason) {
app_manager->HeadUnitReset(mob_reason);
}
-
kill(getpid(), SIGINT);
}
void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() {
- LOG4CXX_INFO(logger_, ""
- "OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete");
+ LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject* message =
+ smart_objects::SmartObjectSPtr message =
new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete;
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 f4aed61392..9cb40bd645 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -49,7 +49,7 @@ OnExitApplicationNotification::~OnExitApplicationNotification() {
}
void OnExitApplicationNotification::Run() {
- LOG4CXX_INFO(logger_, "OnExitApplicationNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance();
ApplicationSharedPtr app_impl = app_mgr->application(
@@ -70,7 +70,10 @@ void OnExitApplicationNotification::Run() {
break;
}
}
- app_impl->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app_impl->app_id(),
+ mobile_apis::HMILevel::HMI_NONE);
+
app_impl->set_audio_streaming_state(mobile_apis::AudioStreamingState::NOT_AUDIBLE);
app_impl->set_system_context(mobile_api::SystemContext::SYSCTXT_MAIN);
MessageHelper::SendHMIStatusNotification(*app_impl);
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 f1a590ee04..83c3e61a0c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnFileRemovedNotification::~OnFileRemovedNotification() {
}
void OnFileRemovedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnFileRemovedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 bc32ab1cf0..fc1b72c73a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ OnFindApplications::~OnFindApplications() {
}
void OnFindApplications::Run() {
- LOG4CXX_INFO(logger_, "OnFindApplications::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(PV): add UpdateAppsOnDevice to ApplicationManager
}
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 523013734f..32babf05cc 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {
}
void OnIgnitionCycleOverNotification::Run() {
- LOG4CXX_INFO(logger_, "OnIgnitionCycleOverNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
policy::PolicyHandler::instance()->OnIgnitionCycleOver();
}
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 a68ae90796..87db5d4a38 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {
}
void OnNaviTBTClientStateNotification::Run() {
- LOG4CXX_INFO(logger_, "OnNaviTBTClientStateNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc b/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
index 9bd9099c75..9cee8801e7 100644
--- a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -50,7 +50,7 @@ OnPhoneCallNotification::~OnPhoneCallNotification() {
}
void OnPhoneCallNotification::Run() {
- LOG4CXX_INFO(logger_, "OnPhoneCallNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
bool is_active =
(*message_)[strings::msg_params][hmi_notification::is_active].asBool();
diff --git a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc b/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc
index e05b38d456..9820bb02ad 100644
--- a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ OnPlayToneNotification::~OnPlayToneNotification() {
}
void OnPlayToneNotification::Run() {
- LOG4CXX_INFO(logger_, "OnPlayToneNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 b3f5803d44..56c544888a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ OnPolicyUpdate::~OnPolicyUpdate() {
}
void OnPolicyUpdate::Run() {
- LOG4CXX_INFO(logger_, "OnPolicyUpdate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
policy::PolicyHandler::instance()->OnPTExchangeNeeded();
}
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 2fecbec9c7..cf0297df01 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnPutFileNotification::~OnPutFileNotification() {
}
void OnPutFileNotification::Run() {
- LOG4CXX_INFO(logger_, "OnPutFileNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 783aa4af40..f1ac8b6d3c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnReadyNotification::~OnReadyNotification() {
}
void OnReadyNotification::Run() {
- LOG4CXX_INFO(logger_, "OnReadyNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->OnHMIStartedCooperation();
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady);
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 1e517f35de..a5ea29c6d2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {
}
void OnReceivedPolicyUpdate::Run() {
- LOG4CXX_INFO(logger_, "OnReceivedPolicyUpdate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const std::string& file_path =
(*message_)[strings::msg_params][hmi_notification::policyfile].asString();
policy::BinaryMessage file_content;
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 e0dae8f045..163b525628 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnRecordStartdNotification::~OnRecordStartdNotification() {
}
void OnRecordStartdNotification::Run() {
- LOG4CXX_INFO(logger_, "OnRecordStartdNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 70868b826f..8e00c3447c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {
}
void OnResumeAudioSourceNotification::Run() {
- LOG4CXX_INFO(logger_, "OnResumeAudioSourceNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 70240b4bf6..c393219134 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 1fda4986e4..20010111fd 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
@@ -46,7 +46,7 @@ OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {
}
void OnSDLConsentNeededNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSDLConsentNeededNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc
index d71413ef85..afe0ffeabc 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 fc5ffed42c..6f867adbcd 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {
}
void OnStartDeviceDiscovery::Run() {
- LOG4CXX_INFO(logger_, "OnStartDeviceDiscovery::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->StartDevicesDiscovery();
}
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 6e4e65987e..7db0053e2d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 5a5c12b907..8dbd1e13e4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnSystemContextNotification::~OnSystemContextNotification() {
}
void OnSystemContextNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSystemContextNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
mobile_api::SystemContext::eType system_context =
static_cast<mobile_api::SystemContext::eType>(
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 bac3d37359..09a96cc797 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnSystemErrorNotification::~OnSystemErrorNotification() {
}
void OnSystemErrorNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSystemErrorNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
int code = (*message_)[strings::msg_params][hmi_notification::error]
.asInt();
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 ec8460d581..fb5a9abc43 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {
}
void OnSystemInfoChangedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSystemInfoChangedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t lang_code =
(*message_)[strings::msg_params][strings::language].asUInt();
const std::string language =
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 e3d0ea511d..a77bd24766 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -52,7 +52,7 @@ OnSystemRequestNotification::~OnSystemRequestNotification() {
}
void OnSystemRequestNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSystemRequestNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& params = (*message_)[strings::params];
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
@@ -60,7 +60,8 @@ void OnSystemRequestNotification::Run() {
params[strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID);
- std::string app_id = msg_params[strings::app_id].asString();
+ const std::string app_id = msg_params[strings::app_id].asString();
+ LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for " << app_id );
if (strings::default_app_id == app_id) {
PolicyHandler* policy_handler = PolicyHandler::instance();
@@ -81,7 +82,8 @@ void OnSystemRequestNotification::Run() {
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application_by_policy_id(app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Application with such id is not yet registered.");
+ LOG4CXX_WARN(logger_, "Application with id " << app_id
+ << " is not registered.");
return;
}
params[strings::connection_key] = app->app_id();
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 60c0dca10a..5dba6400b8 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -49,7 +49,7 @@ OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {
}
void OnTTSLanguageChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTTSLanguageChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
@@ -71,10 +71,9 @@ void OnTTSLanguageChangeNotification::Run() {
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
- std::set<ApplicationSharedPtr>::iterator it = applications.begin();
- for (;applications.end() != it; ++it) {
+ ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ for (;accessor.end() != it; ++it) {
ApplicationSharedPtr app = (*it);
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
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 047a5d985d..96089384c4 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
@@ -16,7 +16,7 @@ OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {
}
void OnTTSResetTimeoutNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTTSResetTimeoutNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout);
event.set_smart_object(*message_);
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 519fc290d9..8213474c09 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnTTSStartedNotification::~OnTTSStartedNotification() {
}
void OnTTSStartedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTTSStartedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->Mute(kTTSSessionChanging);
}
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 b3e3683f32..c812c84af5 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnTTSStoppedNotification::~OnTTSStoppedNotification() {
}
void OnTTSStoppedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTTSStoppedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped);
event.set_smart_object(*message_);
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 4ed5839e5f..d8fe1ebdea 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnUICommandNotification::~OnUICommandNotification() {
}
void OnUICommandNotification::Run() {
- LOG4CXX_INFO(logger_, "OnUICommandNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID);
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 45ff7425b7..9dcfe01e60 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {
}
void OnUIKeyBoardInputNotification::Run() {
- LOG4CXX_INFO(logger_, "OnUIKeyBoardInputNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
//prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 5756f50eb5..931a27abc4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -49,7 +49,7 @@ OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {
}
void OnUILanguageChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnUILanguageChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
@@ -68,10 +68,9 @@ void OnUILanguageChangeNotification::Run() {
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
- std::set<ApplicationSharedPtr>::iterator it = applications.begin();
- for (;applications.end() != it; ++it) {
+ ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ for (;accessor.end() != it; ++it) {
ApplicationSharedPtr app = *it;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
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 357bfc4cb3..96f65839c1 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -48,7 +48,7 @@ OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {
}
void OnUIResetTimeoutNotification::Run() {
- LOG4CXX_INFO(logger_, "OnUIResetTimeoutNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
event.set_smart_object(*message_);
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 7868e81193..00e0e4d2c6 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ OnUITouchEventNotification::~OnUITouchEventNotification() {
}
void OnUITouchEventNotification::Run() {
- LOG4CXX_INFO(logger_, "OnUITouchEventNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
//prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 a5b84748ef..8716fb4165 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ OnUpdateDeviceList::~OnUpdateDeviceList() {
}
void OnUpdateDeviceList::Run() {
- LOG4CXX_INFO(logger_, "OnUpdateDeviceList::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
}
} // namespace commands
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 be0c4ebb60..f1e515e2f2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {
}
void OnVIAccPedalPositionNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIAccPedalPositionNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 688a5c1fb1..0dd5361f74 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {
}
void OnVIBeltStatusNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIBeltStatusNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 e80a2edcf3..27c902c880 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {
}
void OnVIBodyInformationNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIBodyInformationNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 4669398da1..07b96f1011 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {
}
void OnVIDeviceStatusNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIDeviceStatusNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 8b61d0af21..57a8f9c6ef 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {
}
void OnVIDriverBrakingNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIDriverBrakingNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 1b0989b1ec..7509884497 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {
}
void OnVIEngineTorqueNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIEngineTorqueNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 f7a9213598..64dd411bdd 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {
}
void OnVIExternalTemperatureNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIExternalTemperatureNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 97d797b630..59ecab0abc 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {
}
void OnVIFuelLevelNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIFuelLevelNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 0024f17a80..faa8a0522a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {
}
void OnVIFuelLevelStateNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIFuelLevelStateNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 5b7ec72977..df582418cb 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIGpsDataNotification::~OnVIGpsDataNotification() {
}
void OnVIGpsDataNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIGpsDataNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 355c00f0c9..01a0a725ef 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {
}
void OnVIHeadLampStatusNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIHeadLampStatusNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 17240bce6c..b13d50fc1c 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIInstantFuelConsumptionNotification::~OnVIInstantFuelConsumptionNotification(
}
void OnVIInstantFuelConsumptionNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIInstantFuelConsumptionNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 1caaecb442..71870522ce 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIMyKeyNotification::~OnVIMyKeyNotification() {
}
void OnVIMyKeyNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIMyKeyNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 02127a1389..5db3ef3bb3 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIOdometerNotification::~OnVIOdometerNotification() {
}
void OnVIOdometerNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIOdometerNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 4692191cb3..1739f4809b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIPrndlNotification::~OnVIPrndlNotification() {
}
void OnVIPrndlNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIPrndlNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 b16421903a..336847ced0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIRpmNotification::~OnVIRpmNotification() {
}
void OnVIRpmNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIRpmNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 6bc1e8b2cf..ad38bf50a5 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVISpeedNotification::~OnVISpeedNotification() {
}
void OnVISpeedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVISpeedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 853b4eeea3..4fd70bf169 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {
}
void OnVISteeringWheelAngleNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVISteeringWheelAngleNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 01ac7e9f8c..fda6e6e28d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVITirePressureNotification::~OnVITirePressureNotification() {
}
void OnVITirePressureNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVITirePressureNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 eda88ef602..15ccf940b8 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {
}
void OnVIVehicleDataNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIVehicleDataNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 546dc0d3cf..aa1683c5fb 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIVinNotification::~OnVIVinNotification() {
}
void OnVIVinNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIVinNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 101427df0a..0d27f42388 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {
}
void OnVIWiperStatusNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVIWiperStatusNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
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 99842b8524..bcd02196a8 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -51,7 +51,7 @@ OnVRCommandNotification::~OnVRCommandNotification() {
}
void OnVRCommandNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVRCommandNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr active_app = ApplicationManagerImpl::instance()
->active_application();
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 92e7cb7b23..19d064d15b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -49,7 +49,7 @@ OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {
}
void OnVRLanguageChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVRLanguageChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
@@ -65,16 +65,17 @@ void OnVRLanguageChangeNotification::Run() {
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
- std::set<ApplicationSharedPtr>::iterator it = applications.begin();
- for (;applications.end() != it; ++it) {
+ ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ for (;accessor.end() != it; ++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()) {
- app->set_hmi_level(mobile_api::HMILevel::HMI_NONE);
+
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ mobile_api::HMILevel::HMI_NONE);
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
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 72f6767e8c..6e56dd29c0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVRStartedNotification::~OnVRStartedNotification() {
}
void OnVRStartedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVRStartedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->set_vr_session_started(true);
ApplicationManagerImpl::instance()->Mute(kVRSessionChanging);
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 46274a3b2e..442968ea1e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ OnVRStoppedNotification::~OnVRStoppedNotification() {
}
void OnVRStoppedNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVRStoppedNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->set_vr_session_started(false);
ApplicationManagerImpl::instance()->Unmute(kVRSessionChanging);
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 7b7f740904..44eb24b7ab 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
@@ -58,6 +58,28 @@ bool RequestFromHMI::CleanUp() {
void RequestFromHMI::Run() {
}
+void RequestFromHMI::on_event(const event_engine::Event& event) {
+}
+
+void RequestFromHMI::SendResponse(bool success,
+ 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);
+
+ (*message)[strings::params][strings::function_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] = 0;
+
+ (*message)[strings::msg_params][strings::success] = success;
+ (*message)[strings::msg_params][strings::result_code] = result_code;
+
+ ApplicationManagerImpl::instance()->ManageHMICommand(message);
+}
+
+
} // 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 242118a417..82b36be0f0 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
@@ -1,4 +1,4 @@
-/**
+/*
Copyright (c) 2014, Ford Motor Company
All rights reserved.
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 42bebb847d..9f6ced5974 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
@@ -72,10 +72,9 @@ void ResponseFromHMI::SendResponseToMobile(const MessageSharedPtr& message) {
void ResponseFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
- const NsSmart::SmartObject& msg_params) const {
+ const smart_objects::SmartObject& msg_params) const {
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
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 72abf233ce..a65fd981bc 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,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -32,6 +32,7 @@
#include "application_manager/commands/hmi/sdl_activate_app_request.h"
#include "application_manager/policies/policy_handler.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -45,10 +46,53 @@ SDLActivateAppRequest::~SDLActivateAppRequest() {
}
void SDLActivateAppRequest::Run() {
- LOG4CXX_INFO(logger_, "SDLActivateAppRequest::Run");
- policy::PolicyHandler::instance()->OnActivateApp(
- (*message_)[strings::msg_params][strings::app_id].asUInt(),
- (*message_)[strings::params][strings::correlation_id].asInt());
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis::FunctionID;
+
+ const uint32_t application_id = app_id();
+ ApplicationConstSharedPtr app =
+ ApplicationManagerImpl::instance()->application(application_id);
+
+ if (app && !app->IsRegistered()) {
+ MessageHelper::SendLaunchApp(application_id,
+ app->SchemaUrl(),
+ app->PackageName());
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ } else {
+ policy::PolicyHandler::instance()->OnActivateApp(application_id,
+ correlation_id());
+ }
+}
+
+void SDLActivateAppRequest::onTimeOut() {
+ using namespace hmi_apis::FunctionID;
+ using namespace hmi_apis::Common_Result;
+ using namespace application_manager;
+ unsubscribe_from_event(BasicCommunication_OnAppRegistered);
+ const bool is_success = false;
+ SendResponse(is_success, correlation_id(),
+ BasicCommunication_ActivateApp, APPLICATION_NOT_REGISTERED);
+}
+
+void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
+ using namespace hmi_apis::FunctionID;
+ if (event.id() != BasicCommunication_OnAppRegistered) {
+ return;
+ }
+ unsubscribe_from_event(BasicCommunication_OnAppRegistered);
+ policy::PolicyHandler::instance()->OnActivateApp(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();
+ }
+ }
+ LOG4CXX_DEBUG(logger_, "app_id section is absent in the message.");
+ return 0;
}
} // namespace commands
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 46eb402f41..6c7a0b5355 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ SDLActivateAppResponse::~SDLActivateAppResponse() {
}
void SDLActivateAppResponse::Run() {
- LOG4CXX_INFO(logger_, "SDLActivateAppResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 7eb5a268ac..a6649b2579 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {
}
void SDLGetListOfPermissionsRequest::Run() {
- LOG4CXX_INFO(logger_, "SDLGetListOfPermissionsRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_key = 0;
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
connection_key = (*message_)[strings::msg_params][strings::app_id].asUInt();
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 da474cb128..5d5e75e5c7 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {
}
void SDLGetListOfPermissionsResponse::Run() {
- LOG4CXX_INFO(logger_, "SDLGetListOfPermissionsResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 cc5fbc63ae..dd977d99f0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {
}
void SDLGetStatusUpdateRequest::Run() {
- LOG4CXX_INFO(logger_, "SDLGetStatusUpdateRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
policy::PolicyHandler::instance()->OnGetStatusUpdate(
(*message_)[strings::params][strings::correlation_id].asUInt());
}
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 08d8d315a5..ab1c57e9af 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {
}
void SDLGetStatusUpdateResponse::Run() {
- LOG4CXX_INFO(logger_, "SDLGetStatusUpdateResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 047d6bf846..cdd5c16ed0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -48,7 +48,7 @@ SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {
}
void SDLGetUserFriendlyMessageRequest::Run() {
- LOG4CXX_INFO(logger_, "SDLGetUserFriendlyMessageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const std::string messageCodes = "messageCodes";
if (!(*message_)[strings::msg_params].keyExists(messageCodes)) {
LOG4CXX_WARN(logger_,
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 c849204cc3..8cc1b2d629 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {
}
void SDLGetUserFriendlyMessageResponse::Run() {
- LOG4CXX_INFO(logger_, "SDLGetUserFriendlyMessageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 4779e106c5..b9c5aaa086 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ SDLPolicyUpdate::~SDLPolicyUpdate() {
}
void SDLPolicyUpdate::Run() {
- LOG4CXX_INFO(logger_, "SDLPolicyUpdate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 a3db3a9047..bc7c6e0d74 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -43,7 +43,7 @@ SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {
}
void SDLPolicyUpdateResponse::Run() {
- LOG4CXX_INFO(logger_, "SDLPolicyUpdateResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(PV): add some logic here
}
} // namespace commands
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 638503d162..dd127ec43f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {
}
void TTSChangeRegistrationRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSChangeRegistrationRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 67e48b4ed5..03b51e5db7 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {
}
void TTSChangeRegistratioResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSChangeRegistratioResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration);
event.set_smart_object(*message_);
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 59cf50b38d..fb3dedc1c0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {
}
void TTSGetCapabilitiesRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSGetCapabilitiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 f7309822d8..53a1bd3916 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {
}
void TTSGetCapabilitiesResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSGetCapabilitiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 9f2fe7134a..6d4e4f465a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSGetLanguageRequest::~TTSGetLanguageRequest() {
}
void TTSGetLanguageRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSGetLanguageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 e26fa87739..6c2122557b 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,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSGetLanguageResponse::~TTSGetLanguageResponse() {
}
void TTSGetLanguageResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSGetLanguageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 08c1d82448..5251832bc1 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {
}
void TTSGetSupportedLanguagesRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSGetSupportedLanguagesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 aa041f66b3..a5d022a6cb 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {
}
void TTSGetSupportedLanguagesResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSGetSupportedLanguagesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
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 7733de4887..3a50cfef90 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSIsReadyRequest::~TTSIsReadyRequest() {
}
void TTSIsReadyRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSIsReadyRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 fb3cb4858f..dd8eab7534 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSIsReadyResponse::~TTSIsReadyResponse() {
}
void TTSIsReadyResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSIsReadyResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
bool is_available = false;
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 04f1380d91..ce330c355f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {
}
void TTSSetGlobalPropertiesRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSSetGlobalPropertiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 c90655186f..70dc46d6a6 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {
}
void TTSSetGlobalPropertiesResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSSetGlobalPropertiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*message_);
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 9b4bd68585..79fbde2c4f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSSpeakRequest::~TTSSpeakRequest() {
}
void TTSSpeakRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSSpeakRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 9b9e43dbe8..ff60115e70 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ TTSSpeakResponse::~TTSSpeakResponse() {
}
void TTSSpeakResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSSpeakResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*message_);
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 107cb7933b..32aaec27e7 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {
}
void TTSStopSpeakingRequest::Run() {
- LOG4CXX_INFO(logger_, "TTSStopSpeakingRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 9bd4f89660..b32cf52bb5 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {
}
void TTSStopSpeakingResponse::Run() {
- LOG4CXX_INFO(logger_, "TTSStopSpeakingResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking);
event.set_smart_object(*message_);
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 9aa5d2e2d3..ed9f7979a1 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIAddCommandRequest::~UIAddCommandRequest() {
}
void UIAddCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "UIAddCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 21b34e0637..13b2ab1b2b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIAddCommandResponse::~UIAddCommandResponse() {
}
void UIAddCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "UIAddCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand);
event.set_smart_object(*message_);
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 7a9c5c6fed..667499584f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 af88de2b48..54247dbbce 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIAddSubmenuResponse::~UIAddSubmenuResponse() {
}
void UIAddSubmenuResponse::Run() {
- LOG4CXX_INFO(logger_, "UIAddSubmenuResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu);
event.set_smart_object(*message_);
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 f8c9ed5708..c706d5fdba 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIAlertRequest::~UIAlertRequest() {
}
void UIAlertRequest::Run() {
- LOG4CXX_INFO(logger_, "UIAlertRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 289b90d290..8c9ddef7ac 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIAlertResponse::~UIAlertResponse() {
}
void UIAlertResponse::Run() {
- LOG4CXX_INFO(logger_, "UIAlertResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Alert);
event.set_smart_object(*message_);
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 fbba2b4023..67c9be6cb5 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {
}
void UIChangeRegistrationRequest::Run() {
- LOG4CXX_INFO(logger_, "UIChangeRegistrationRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 16447077dd..1d59d66d74 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {
}
void UIChangeRegistratioResponse::Run() {
- LOG4CXX_INFO(logger_, "UIChangeRegistratioResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration);
event.set_smart_object(*message_);
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 23fb4c67f5..7d5532f30f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIDeleteCommandRequest::~UIDeleteCommandRequest() {
}
void UIDeleteCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "UIDeleteCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 0ac32877c4..2fb94a63a3 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIDeleteCommandResponse::~UIDeleteCommandResponse() {
}
void UIDeleteCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "UIDeleteCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand);
event.set_smart_object(*message_);
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 41f356b981..e945139639 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {
}
void UIDeleteSubmenuRequest::Run() {
- LOG4CXX_INFO(logger_, "UIDeleteSubmenuRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 5a3359b722..89a5a19a0b 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {
}
void UIDeleteSubmenuResponse::Run() {
- LOG4CXX_INFO(logger_, "UIDeleteSubmenuResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
event.set_smart_object(*message_);
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 4c93f9235b..b87e1d89b8 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {
}
void UIEndAudioPassThruRequest::Run() {
- LOG4CXX_INFO(logger_, "UIEndAudioPassThruRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 e560ae293a..8f5d92b78f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {
}
void UIEndAudioPassThruResponse::Run() {
- LOG4CXX_INFO(logger_, "UIEndAudioPassThruResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*message_);
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 b9f1b6917c..74ee67e884 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {
}
void UIGetCapabilitiesRequest::Run() {
- LOG4CXX_INFO(logger_, "UIGetCapabilitiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 0663bf033e..7ebc5ffcc9 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {
}
void UIGetCapabilitiesResponse::Run() {
- LOG4CXX_INFO(logger_, "UIGetCapabilitiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 ffca242d43..1b22a9b58f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIGetLanguageRequest::~UIGetLanguageRequest() {
}
void UIGetLanguageRequest::Run() {
- LOG4CXX_INFO(logger_, "UIGetLanguageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc
index 20435d788b..cba85d91e7 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,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIGetLanguageResponse::~UIGetLanguageResponse() {
}
void UIGetLanguageResponse::Run() {
- LOG4CXX_INFO(logger_, "UIGetLanguageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 455486ef6c..5cd0c09e65 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {
}
void UIGetSupportedLanguagesRequest::Run() {
- LOG4CXX_INFO(logger_, "UIGetSupportedLanguagesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 8492cfca5b..2057f3cbb2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {
}
void UIGetSupportedLanguagesResponse::Run() {
- LOG4CXX_INFO(logger_, "UIGetSupportedLanguagesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
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 50d0ddd95a..94df3cec7d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIIsReadyRequest::~UIIsReadyRequest() {
}
void UIIsReadyRequest::Run() {
- LOG4CXX_INFO(logger_, "UIIsReadyRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 97d11b6022..9edf77080e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIIsReadyResponse::~UIIsReadyResponse() {
}
void UIIsReadyResponse::Run() {
- LOG4CXX_INFO(logger_, "UIIsReadyResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
bool is_available = false;
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 cf77703a9b..3cf7722b24 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {
}
void UIPerformAudioPassThruRequest::Run() {
- LOG4CXX_INFO(logger_, "UIPerformAudioPassThruRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 36d4c507b5..c8a488e44d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {
}
void UIPerformAudioPassThruResponse::Run() {
- LOG4CXX_INFO(logger_, "UIPerformAudioPassThruResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
event.set_smart_object(*message_);
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 09f98ec036..2b1f5ce484 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIPerformInteractionRequest::~UIPerformInteractionRequest() {
}
void UIPerformInteractionRequest::Run() {
- LOG4CXX_INFO(logger_, "UIPerformInteractionRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 2f5f6ead57..25237525da 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIPerformInteractionResponse::~UIPerformInteractionResponse() {
}
void UIPerformInteractionResponse::Run() {
- LOG4CXX_INFO(logger_, "UIPerformInteractionResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction);
event.set_smart_object(*message_);
event.raise();
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 ac34dd236f..911c840ce4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UIScrollableMessageRequest::~UIScrollableMessageRequest() {
}
void UIScrollableMessageRequest::Run() {
- LOG4CXX_INFO(logger_, "UIScrollableMessageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 182d512c8c..58c793c3b6 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UIScrollableMessageResponse::~UIScrollableMessageResponse() {
}
void UIScrollableMessageResponse::Run() {
- LOG4CXX_INFO(logger_, "UIScrollableMessageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage);
event.set_smart_object(*message_);
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
new file mode 100644
index 0000000000..c4a3b3b3af
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/hmi/ui_set_app_icon_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+UISetAppIconRequest::UISetAppIconRequest(const MessageSharedPtr& message)
+ : RequestToHMI(message) {
+}
+
+UISetAppIconRequest::~UISetAppIconRequest() {
+}
+
+void UISetAppIconRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // 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
new file mode 100644
index 0000000000..46c10e8f22
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "application_manager/commands/hmi/ui_set_app_icon_response.h"
+#include "application_manager/event_engine/event.h"
+#include "interfaces/HMI_API.h"
+
+namespace application_manager {
+
+namespace commands {
+
+UISetAppIconResponse::UISetAppIconResponse(const MessageSharedPtr& message)
+ : ResponseFromHMI(message) {
+}
+
+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();
+}
+
+} // namespace commands
+
+} // namespace application_manager
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 3dea853486..df9f6cf2a6 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {
}
void UiSetDisplayLayoutRequest::Run() {
- LOG4CXX_INFO(logger_, "UiSetDisplayLayoutRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 f381a4db28..f23cc92642 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {
}
void UiSetDisplayLayoutResponse::Run() {
- LOG4CXX_INFO(logger_, "UiSetDisplayLayoutResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
event.set_smart_object(*message_);
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 e538866c1b..39a0e865df 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {
}
void UISetGlobalPropertiesRequest::Run() {
- LOG4CXX_INFO(logger_, "UISetGlobalPropertiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 67023533c9..23173961fb 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {
}
void UISetGlobalPropertiesResponse::Run() {
- LOG4CXX_INFO(logger_, "UISetGlobalPropertiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*message_);
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 1eb218013b..272ff561aa 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {
}
void UISetMediaClockTimerRequest::Run() {
- LOG4CXX_INFO(logger_, "UISetMediaClockTimerRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 ee67862a1a..ae878bd694 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {
}
void UISetMediaClockTimerResponse::Run() {
- LOG4CXX_INFO(logger_, "UISetMediaClockTimerResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*message_);
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 841c8a62fa..65b9894902 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIShowRequest::~UIShowRequest() {
}
void UIShowRequest::Run() {
- LOG4CXX_INFO(logger_, "UIShowRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 c95cbbd2ba..8d348e6086 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UIShowResponse::~UIShowResponse() {
}
void UIShowResponse::Run() {
- LOG4CXX_INFO(logger_, "UIShowResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*message_);
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 fc7203c0ea..c8d3242d98 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UISliderRequest::~UISliderRequest() {
}
void UISliderRequest::Run() {
- LOG4CXX_INFO(logger_, "UISliderRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 8d2522e224..7837117ebd 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ UISliderResponse::~UISliderResponse() {
}
void UISliderResponse::Run() {
- LOG4CXX_INFO(logger_, "UISliderResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::UI_Slider);
event.set_smart_object(*message_);
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 955f4b19c6..72f65d1a2e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UpdateAppListRequest::~UpdateAppListRequest() {
}
void UpdateAppListRequest::Run() {
- LOG4CXX_INFO(logger_, "UpdateAppListRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 d5db0b4ea8..308bce3ad2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UpdateAppListResponse::~UpdateAppListResponse() {
}
void UpdateAppListResponse::Run() {
- LOG4CXX_INFO(logger_, "UpdateAppListResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(PV): add check
}
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 1f632378b4..696e2f85c4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -50,17 +50,17 @@ UpdateDeviceListRequest::~UpdateDeviceListRequest() {
}
void UpdateDeviceListRequest::Run() {
- LOG4CXX_INFO(logger_, "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 "CUSTOMER_PASA" 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()) {
- LOG4CXX_INFO(logger_, "MY Wait for HMI Cooperation");
+ LOG4CXX_INFO(logger_, "Wait for HMI Cooperation");
subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
termination_condition_.Wait(auto_lock);
- LOG4CXX_INFO(logger_, "MY HMI Cooperation OK");
+ LOG4CXX_DEBUG(logger_, "HMI Cooperation OK");
}
}
@@ -68,7 +68,7 @@ void UpdateDeviceListRequest::Run() {
}
void UpdateDeviceListRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "UpdateDeviceListRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(wait_hmi_lock);
switch (event.id()) {
case hmi_apis::FunctionID::BasicCommunication_OnReady : {
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 85ef57404c..b3e0f9a309 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UpdateDeviceListResponse::~UpdateDeviceListResponse() {
}
void UpdateDeviceListResponse::Run() {
- LOG4CXX_INFO(logger_, "UpdateDeviceListResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(PV): add check for correctness.
}
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 7d47f84ce3..b03e595e9c 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
@@ -46,7 +46,7 @@ UpdateSDLRequest::~UpdateSDLRequest() {
}
void UpdateSDLRequest::Run() {
- LOG4CXX_INFO(logger_, "UpdateSDLRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
policy::PolicyHandler::instance()->PTExchangeAtUserRequest(
(*message_)[strings::params][strings::correlation_id].asInt());
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 d2be2c655c..d9c8b6102f 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ UpdateSDLResponse::~UpdateSDLResponse() {
}
void UpdateSDLResponse::Run() {
- LOG4CXX_INFO(logger_, "UpdateSDLResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
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 45d44e4475..eb9a9841be 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {
}
void VIDiagnosticMessageRequest::Run() {
- LOG4CXX_INFO(logger_, "VIDiagnosticMessageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 d83869b279..4183395e99 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {
}
void VIDiagnosticMessageResponse::Run() {
- LOG4CXX_INFO(logger_, "VIDiagnosticMessageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage);
event.set_smart_object(*message_);
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 5289816fb5..a89252ada2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VIGetDTCsRequest::~VIGetDTCsRequest() {
}
void VIGetDTCsRequest::Run() {
- LOG4CXX_INFO(logger_, "VIGetDTCsRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 0cacc51d6c..c44f5213d2 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIGetDTCsResponse::~VIGetDTCsResponse() {
}
void VIGetDTCsResponse::Run() {
- LOG4CXX_INFO(logger_, "VIGetDTCsResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
event.set_smart_object(*message_);
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 40b2ca9fed..37d5ede4b0 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {
}
void VIGetVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 73444a19bd..0ed0f7f515 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -35,7 +35,6 @@
#include "interfaces/HMI_API.h"
namespace application_manager {
-
namespace commands {
VIGetVehicleDataResponse::VIGetVehicleDataResponse(
@@ -47,22 +46,14 @@ VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {
}
void VIGetVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleDataResponse::Run");
- smart_objects::SmartObject* result_so = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- if (!result_so) {
- // TODO(PV): add response with out of memory.
- LOG4CXX_ERROR(logger_,
- "Failed to create new Smart Object on get vehicle response.");
- return;
- }
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
- smart_objects::SmartObject& result = *result_so;
-
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)) {
result[strings::msg_params] = (*message_)[strings::params][strings::data];
result[strings::params][hmi_response::code] =
@@ -79,17 +70,14 @@ void VIGetVehicleDataResponse::Run() {
(*message_)[strings::params][strings::protocol_version];
}
-
- event.set_smart_object(*result_so);
+ event.set_smart_object(result);
} else {
event.set_smart_object(*message_);
policy::PolicyHandler::instance()->OnVehicleDataUpdated(*message_);
}
-
event.raise();
}
} // namespace commands
-
} // namespace application_manager
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 4c46de950e..11dd26dfad 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {
}
void VIGetVehicleTypeRequest::Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleTypeRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 18c0136d12..2b5f6b96be 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {
}
void VIGetVehicleTypeResponse::Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleTypeResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 074d6f6022..aae05e0fcc 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VIIsReadyRequest::~VIIsReadyRequest() {
}
void VIIsReadyRequest::Run() {
- LOG4CXX_INFO(logger_, "VIIsReadyRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 e7c9c180c2..4a79a6d9b9 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIIsReadyResponse::~VIIsReadyResponse() {
}
void VIIsReadyResponse::Run() {
- LOG4CXX_INFO(logger_, "VIIsReadyResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
bool is_available = false;
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 1485b471c4..92a105dde4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VIReadDIDRequest::~VIReadDIDRequest() {
}
void VIReadDIDRequest::Run() {
- LOG4CXX_INFO(logger_, "VIReadDIDRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 ddd9f3c540..675b944272 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ VIReadDIDResponse::~VIReadDIDResponse() {
}
void VIReadDIDResponse::Run() {
- LOG4CXX_INFO(logger_, "VIReadDIDResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID);
event.set_smart_object(*message_);
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 38950a2a2b..5ad4daea94 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {
}
void VISubscribeVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "VISubscribeVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 bd67294fbb..91d9c85382 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {
}
void VISubscribeVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "VISubscribeVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData
);
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 0af87c2a2e..7c12cbe6f1 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {
}
void VIUnsubscribeVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "VIUnsubscribeVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 22231b4a61..124b7dacbd 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {
}
void VIUnsubscribeVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "VIUnsubscribeVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData
);
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 a74ece95da..c900df1678 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VRAddCommandRequest::~VRAddCommandRequest() {
}
void VRAddCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "VRAddCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 513ccdace2..3d34b5c65a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRAddCommandResponse::~VRAddCommandResponse() {
}
void VRAddCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "VRAddCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
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 bd7c1e7841..fe8ee69021 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {
}
void VRChangeRegistrationRequest::Run() {
- LOG4CXX_INFO(logger_, "VRChangeRegistrationRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc
index 92a36d23f6..5bd2fb853a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 0241be6308..e3052ae208 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VRDeleteCommandRequest::~VRDeleteCommandRequest() {
}
void VRDeleteCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "VRDeleteCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 c5a13126b0..8954b1d1b9 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -46,7 +46,7 @@ VRDeleteCommandResponse::~VRDeleteCommandResponse() {
}
void VRDeleteCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "VRDeleteCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand);
event.set_smart_object(*message_);
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 8b1d4ae0b4..58d0a4b3e4 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {
}
void VRGetCapabilitiesRequest::Run() {
- LOG4CXX_INFO(logger_, "VRGetCapabilitiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 de6fdd7a93..5ca1d86190 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {
}
void VRGetCapabilitiesResponse::Run() {
- LOG4CXX_INFO(logger_, "VRGetCapabilitiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 9f4aeb9797..0b98979418 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VRGetLanguageRequest::~VRGetLanguageRequest() {
}
void VRGetLanguageRequest::Run() {
- LOG4CXX_INFO(logger_, "VRGetLanguageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 acbd24fbbf..62127bdf9b 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,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRGetLanguageResponse::~VRGetLanguageResponse() {
}
void VRGetLanguageResponse::Run() {
- LOG4CXX_INFO(logger_, "VRGetLanguageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
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 e43d88430d..aea97da02d 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {
}
void VRGetSupportedLanguagesRequest::Run() {
- LOG4CXX_INFO(logger_, "VRGetSupportedLanguagesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 d2cc148a09..b1ea89a460 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,7 +47,7 @@ VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {
}
void VRGetSupportedLanguagesResponse::Run() {
- LOG4CXX_INFO(logger_, "VRGetSupportedLanguagesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
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 944cfcbb3c..a5a3a2b62e 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VRIsReadyRequest::~VRIsReadyRequest() {
}
void VRIsReadyRequest::Run() {
- LOG4CXX_INFO(logger_, "VRIsReadyRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 8cf5e66ee7..a0de7ae33a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -44,7 +44,7 @@ VRIsReadyResponse::~VRIsReadyResponse() {
}
void VRIsReadyResponse::Run() {
- LOG4CXX_INFO(logger_, "VRIsReadyResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& object = *message_;
bool is_available = false;
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 6de32dc5b5..1791bab57a 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRPerformInteractionRequest::~VRPerformInteractionRequest() {
}
void VRPerformInteractionRequest::Run() {
- LOG4CXX_INFO(logger_, "VRPerformInteractionRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
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 fea09b9f29..8fc22ce872 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -45,7 +45,7 @@ VRPerformInteractionResponse::~VRPerformInteractionResponse() {
}
void VRPerformInteractionResponse::Run() {
- LOG4CXX_INFO(logger_, "VRPerformInteractionResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction);
event.set_smart_object(*message_);
event.raise();
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 35cc619895..da44d0e7c4 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
@@ -56,13 +56,13 @@ AddCommandRequest::~AddCommandRequest() {
}
void AddCommandRequest::onTimeOut() {
- LOG4CXX_INFO(logger_, "AddCommandRequest::onTimeOut");
+ LOG4CXX_AUTO_TRACE(logger_);
RemoveCommand();
CommandRequestImpl::onTimeOut();
}
void AddCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "AddCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -198,7 +198,8 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
return false;
}
- const CommandsMap& commands = app->commands_map();
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator i = commands.begin();
uint32_t saved_parent_id = 0;
uint32_t parent_id = 0;
@@ -235,7 +236,8 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) {
return false;
}
- const CommandsMap& commands = app->commands_map();
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator it = commands.begin();
for (; commands.end() != it; ++it) {
@@ -284,10 +286,22 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
}
void AddCommandRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "AddCommandRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ return;
+ }
+
+ smart_objects::SmartObject msg_param(smart_objects::SmartType_Map);
+ msg_param[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id];
+ msg_param[strings::app_id] = application->app_id();
+
switch (event.id()) {
case hmi_apis::FunctionID::UI_AddCommand: {
LOG4CXX_INFO(logger_, "Received UI_AddCommand event");
@@ -296,8 +310,8 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS != ui_result_) {
- (*message_)[strings::msg_params].erase(strings::menu_params);
- }
+ (*message_)[strings::msg_params].erase(strings::menu_params);
+ }
break;
}
case hmi_apis::FunctionID::VR_AddCommand: {
@@ -318,18 +332,18 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
}
if (!IsPendingResponseExist()) {
+
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
- return;
- }
-
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_) &&
@@ -348,6 +362,39 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
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_) {
+
+ 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;
+
+ 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_) {
+
+ 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);
+
+ application->RemoveCommand((*message_)[strings::msg_params]
+ [strings::cmd_id].asUInt());
+ result = false;
+ }
+
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
if (true == result) {
application->UpdateHash();
@@ -360,7 +407,7 @@ bool AddCommandRequest::IsPendingResponseExist() {
}
bool AddCommandRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "AddCommandRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
@@ -397,16 +444,42 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
return false;
}
+bool AddCommandRequest::BothSend() const {
+ return send_vr_ && send_ui_;
+}
+
void AddCommandRequest::RemoveCommand() {
- LOG4CXX_INFO(logger_, "AddCommandRequest::RemoveCommand");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
connection_key());
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "No application associated with session key");
return;
}
+
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id];
+ msg_params[strings::app_id] = app->app_id();
+
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
+ // we have nothing to remove from HMI so no DeleteCommand expected
+ return;
+ }
+
+ if (BothSend() && !is_vr_received_) {
+ SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
+ }
+
+ if (BothSend() && !is_ui_received_) {
+ msg_params[strings::grammar_id] = app->get_grammar_id();
+ msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+ SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ }
+
}
} // 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 0c135af076..51684c065b 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
@@ -46,7 +46,7 @@ AddCommandResponse::~AddCommandResponse() {
}
void AddCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "AddCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 ce6fa3fc51..7e0e6aeca4 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
@@ -47,7 +47,7 @@ AddSubMenuRequest::~AddSubMenuRequest() {
}
void AddSubMenuRequest::Run() {
- LOG4CXX_INFO(logger_, "AddSubMenuRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -95,7 +95,7 @@ void AddSubMenuRequest::Run() {
}
void AddSubMenuRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "AddSubMenuRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc
index bcd7df2888..ff37a6a998 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
@@ -47,7 +47,7 @@ AddSubMenuResponse::~AddSubMenuResponse() {
}
void AddSubMenuResponse::Run() {
- LOG4CXX_INFO(logger_, "AddSubMenuResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 abb5bc7f3c..77d2211157 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
@@ -52,7 +52,7 @@ AlertManeuverRequest::~AlertManeuverRequest() {
}
void AlertManeuverRequest::Run() {
- LOG4CXX_INFO(logger_, "AlertManeuverRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
if ((!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) &&
(!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) {
@@ -127,7 +127,7 @@ void AlertManeuverRequest::Run() {
}
void AlertManeuverRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "AlertManeuverRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
@@ -206,7 +206,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
}
bool AlertManeuverRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "AlertManeuverRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
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 99fcde69a8..8f9c73267f 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
@@ -47,7 +47,7 @@ AlertManeuverResponse::~AlertManeuverResponse() {
}
void AlertManeuverResponse::Run() {
- LOG4CXX_INFO(logger_, "AlertManeuverResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 c08b7c32d7..ccabe4e177 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -84,7 +84,7 @@ bool AlertRequest::Init() {
}
void AlertRequest::Run() {
- LOG4CXX_INFO(logger_, "AlertRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = (*message_)[strings::params][strings::connection_key]
.asInt();
@@ -116,7 +116,7 @@ void AlertRequest::onTimeOut() {
}
void AlertRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "AlertRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -198,20 +198,12 @@ void AlertRequest::on_event(const event_engine::Event& event) {
response_success_ = true;
}
- // If timeout is not set, watchdog will not track request timeout and
- // HMI is responsible for response returning. In this case, if ABORTED will
- // be rerurned from HMI, success should be sent to mobile.
- if (mobile_apis::Result::ABORTED == response_result_ &&
- 0 == default_timeout_) {
- response_success_ = true;
- }
-
- if (mobile_apis::Result::ABORTED == tts_speak_response_ &&
+ 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_);
@@ -332,39 +324,38 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
}
void AlertRequest::SendSpeakRequest(int32_t app_id) {
-
+ using namespace hmi_apis;
+ using namespace smart_objects;
// crate HMI speak request
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ SmartObject msg_params = smart_objects::SmartObject(SmartType_Map);
- msg_params[hmi_request::tts_chunks] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ msg_params[hmi_request::tts_chunks] = smart_objects::SmartObject(SmartType_Array);
msg_params[hmi_request::tts_chunks] =
(*message_)[strings::msg_params][strings::tts_chunks];
msg_params[strings::app_id] = app_id;
- msg_params[hmi_request::speak_type] =
- hmi_apis::Common_SpeakType::ALERT;
- SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true);
+ msg_params[hmi_request::speak_type] = Common_MethodName::ALERT;
+ SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true);
}
void AlertRequest::SendPlayToneNotification(int32_t app_id) {
- LOG4CXX_INFO(logger_, "AlertRequest::SendPlayToneNotification");
+ 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
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- CreateHMINotification(hmi_apis::FunctionID::BasicCommunication_PlayTone,
- msg_params);
+ 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_INFO(logger_, "AlertRequest::CheckStringsOfAlertRequest");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
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 5b8cd6557b..dac086a8b1 100644
--- a/src/components/application_manager/src/commands/mobile/alert_response.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_response.cc
@@ -49,7 +49,7 @@ AlertResponse::~AlertResponse() {
}
void AlertResponse::Run() {
- LOG4CXX_INFO(logger_, "AlertResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 9780aad7bb..89b2dbaf00 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
@@ -55,7 +55,7 @@ ChangeRegistrationRequest::~ChangeRegistrationRequest() {
}
void ChangeRegistrationRequest::Run() {
- LOG4CXX_INFO(logger_, "ChangeRegistrationRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl* instance = ApplicationManagerImpl::instance();
const HMICapabilities& hmi_capabilities = instance->hmi_capabilities();
@@ -166,19 +166,19 @@ void ChangeRegistrationRequest::Run() {
&tts_params, true);
}
-bool ChangeRegistrationRequest::WasAnySuccess(
+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 == ui &&
+ hmi_apis::Common_Result::SUCCESS == vr &&
hmi_apis::Common_Result::SUCCESS == tts;
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ChangeRegistrationRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
hmi_apis::FunctionID::eType event_id = event.id();
@@ -237,7 +237,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
(*message_)[strings::params][strings::function_id] =
mobile_apis::FunctionID::eType::ChangeRegistrationID;
- SendResponse(WasAnySuccess(ui_result_, vr_result_, tts_result_),
+ SendResponse(AllHmiResponsesSuccess(ui_result_, vr_result_, tts_result_),
static_cast<mobile_apis::Result::eType>(greates_result_code),
NULL, &(message[strings::msg_params]));
} else {
@@ -374,21 +374,20 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
}
mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
- LOG4CXX_INFO(logger_, "ChangeRegistrationRequest::CheckCoincidence");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
- std::set<ApplicationSharedPtr>::const_iterator it = applications.begin();
std::string app_name;
uint32_t app_id = connection_key();
if (msg_params.keyExists(strings::app_name)) {
app_name = msg_params[strings::app_name].asString();
}
- for (; applications.end() != it; ++it) {
+ ApplicationManagerImpl::ApplictionSetConstIt it = accessor.begin();
+ for (; accessor.end() != it; ++it) {
if (app_id == (*it)->app_id()) {
continue;
}
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 13c926ec82..557614f173 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
@@ -47,7 +47,7 @@ ChangeRegistrationResponse::~ChangeRegistrationResponse() {
}
void ChangeRegistrationResponse::Run() {
- LOG4CXX_INFO(logger_, "ChangeRegistrationResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 583f0a0460..e980068fd7 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
@@ -53,7 +53,7 @@ CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
}
void CreateInteractionChoiceSetRequest::Run() {
- LOG4CXX_INFO(logger_, "CreateInteractionChoiceSetRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -114,7 +114,7 @@ void CreateInteractionChoiceSetRequest::Run() {
mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
ApplicationConstSharedPtr app) {
- LOG4CXX_INFO(logger_, "CreateInteractionChoiceSetRequest::CheckChoiceSet");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartArray* new_choice_set_array =
(*message_)[strings::msg_params][strings::choice_set].asArray();
@@ -141,7 +141,8 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
}
// Check new choice set params along with already registered choice sets
- const ChoiceSetMap& app_choice_set_map = app->choice_set_map();
+ 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) {
@@ -257,7 +258,7 @@ bool CreateInteractionChoiceSetRequest::compareStr(
bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
const smart_objects::SmartObject& choice_set) {
- LOG4CXX_INFO(logger_, "CreateInteractionChoiceSetRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
str = choice_set[strings::menu_name].asCharArray();
@@ -316,21 +317,21 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
void CreateInteractionChoiceSetRequest::SendVRAddCommandRequest(
application_manager::ApplicationSharedPtr const app) {
- smart_objects::SmartObject* choice_set = &(*message_)[strings::msg_params];
+ smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params];
- for (size_t j = 0; j < (*choice_set)[strings::choice_set].length(); ++j) {
+ for (size_t j = 0; j < choice_set[strings::choice_set].length(); ++j) {
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] =
- (*choice_set)[strings::choice_set][j][strings::choice_id];
+ choice_set[strings::choice_set][j][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][j][strings::vr_commands];
+ choice_set[strings::choice_set][j][strings::vr_commands];
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
- msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id];
+ msg_params[strings::grammar_id] = choice_set[strings::grammar_id];
SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &msg_params);
}
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 8d6ea1b348..bc81206088 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
@@ -49,7 +49,7 @@ CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {
}
void CreateInteractionChoiceSetResponse::Run() {
- LOG4CXX_INFO(logger_, "CreateInteractionChoiceSetResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
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 3c3ee88203..e76422d50e 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
@@ -55,7 +55,7 @@ DeleteCommandRequest::~DeleteCommandRequest() {
}
void DeleteCommandRequest::Run() {
- LOG4CXX_INFO(logger_, "DeleteCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -109,7 +109,7 @@ void DeleteCommandRequest::Run() {
}
void DeleteCommandRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "DeleteCommandRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc
index 812e587430..75178bcb4d 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
@@ -46,7 +46,7 @@ DeleteCommandResponse::~DeleteCommandResponse() {
}
void DeleteCommandResponse::Run() {
- LOG4CXX_INFO(logger_, "DeleteCommandResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 ca5a4395fc..4c753871ce 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
@@ -49,7 +49,7 @@ DeleteFileRequest::~DeleteFileRequest() {
}
void DeleteFileRequest::Run() {
- LOG4CXX_INFO(logger_, "DeleteFileRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
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 81470ccf6b..1bbb18313f 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
@@ -47,7 +47,7 @@ DeleteFileResponse::~DeleteFileResponse() {
}
void DeleteFileResponse::Run() {
- LOG4CXX_INFO(logger_, "DeleteFileResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = (*message_)[strings::params][strings::connection_key]
.asUInt();
ApplicationSharedPtr app =
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 1fcd4b33d8..6c61bfd2a2 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
@@ -50,7 +50,7 @@ DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {
}
void DeleteInteractionChoiceSetRequest::Run() {
- LOG4CXX_INFO(logger_, "DeleteInteractionChoiceSetRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -94,8 +94,9 @@ void DeleteInteractionChoiceSetRequest::Run() {
bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(ApplicationConstSharedPtr app) {
if (app->is_perform_interaction_active()) {
// retrieve stored choice sets for perform interaction
- const PerformChoiceSetMap& choice_set_map = app
- ->performinteraction_choice_set_map();
+ 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) {
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 d260add7cc..f9ee513b94 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
@@ -50,7 +50,7 @@ DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {
}
void DeleteInteractionChoiceSetResponse::Run() {
- LOG4CXX_INFO(logger_, "DeleteInteractionChoiceSetResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
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 d91e742687..6b6bd3fbda 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
@@ -48,7 +48,7 @@ DeleteSubMenuRequest::~DeleteSubMenuRequest() {
}
void DeleteSubMenuRequest::Run() {
- LOG4CXX_INFO(logger_, "DeleteSubMenuRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -77,9 +77,10 @@ void DeleteSubMenuRequest::Run() {
}
void DeleteSubMenuRequest::DeleteSubMenuVRCommands(ApplicationConstSharedPtr app) {
- LOG4CXX_INFO(logger_, "DeleteSubMenuRequest::DeleteSubMenuVRCommands");
+ LOG4CXX_AUTO_TRACE(logger_);
- const CommandsMap& commands = app->commands_map();
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator it = commands.begin();
for (; commands.end() != it; ++it) {
@@ -104,14 +105,16 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(ApplicationConstSharedPtr app
}
void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const app) {
- LOG4CXX_INFO(logger_, "DeleteSubMenuRequest::DeleteSubMenuUICommands");
+ LOG4CXX_AUTO_TRACE(logger_);
- const CommandsMap& commands = app->commands_map();
+ const DataAccessor<CommandsMap> accessor(app->commands_map());
+ const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator it = commands.begin();
while (commands.end() != it) {
-
if (!(*it->second).keyExists(strings::menu_params)) {
+ LOG4CXX_ERROR(logger_, "menu_params not exist");
+ ++it;
continue;
}
@@ -122,9 +125,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const ap
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());
-
it = commands.begin(); // Can not relay on
// iterators after erase was called
@@ -136,7 +137,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const ap
}
void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "DeleteSubMenuRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc
index 0a25a11610..05795e5908 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
@@ -46,7 +46,7 @@ DeleteSubMenuResponse::~DeleteSubMenuResponse() {
}
void DeleteSubMenuResponse::Run() {
- LOG4CXX_INFO(logger_, "DeleteSubMenuResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
index 75016c05fb..7b5cf5fd9a 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
@@ -48,7 +48,7 @@ DiagnosticMessageRequest::~DiagnosticMessageRequest() {
}
void DiagnosticMessageRequest::Run() {
- LOG4CXX_INFO(logger_, "DiagnosticMessageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
connection_key());
@@ -68,7 +68,7 @@ void DiagnosticMessageRequest::Run() {
}
void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "DiagnosticMessageRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc
index 2a8b234fff..9c399a00c8 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
@@ -46,7 +46,7 @@ DiagnosticMessageResponse::~DiagnosticMessageResponse() {
}
void DiagnosticMessageResponse::Run() {
- LOG4CXX_INFO(logger_, "DiagnosticMessageResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 140f43128d..749b19a520 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
@@ -47,7 +47,7 @@ DialNumberRequest::~DialNumberRequest() {
}
void DialNumberRequest::Run() {
- LOG4CXX_INFO(logger_, "DialNumberRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendResponse(false, mobile_apis::Result::UNSUPPORTED_REQUEST);
}
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 eedc9f813e..78a867a6d8 100644
--- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -47,13 +47,13 @@ EndAudioPassThruRequest::~EndAudioPassThruRequest() {
}
void EndAudioPassThruRequest::Run() {
- LOG4CXX_INFO(logger_, "EndAudioPassThruRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true);
}
void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "EndAudioPassThruRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc
index 128d921f9f..0ac1a00bd4 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
@@ -47,7 +47,7 @@ EndAudioPassThruResponse::~EndAudioPassThruResponse() {
}
void EndAudioPassThruResponse::Run() {
- LOG4CXX_INFO(logger_, "EndAudioPassThruResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 9a81f94db1..8e2a0222f7 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
@@ -48,7 +48,7 @@ GetDTCsRequest::~GetDTCsRequest() {
}
void GetDTCsRequest::Run() {
- LOG4CXX_INFO(logger_, "GetDTCsRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -82,7 +82,7 @@ void GetDTCsRequest::Run() {
}
void GetDTCsRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "GetDTCsRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc
index 2ed7a92952..523711c975 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
@@ -46,7 +46,7 @@ GetDTCsResponse::~GetDTCsResponse() {
}
void GetDTCsResponse::Run() {
- LOG4CXX_INFO(logger_, "GetDTCsResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 a3d08a15ff..546b14853c 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
@@ -54,7 +54,7 @@ GetVehicleDataRequest::~GetVehicleDataRequest() {
}
void GetVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "GetVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
@@ -213,7 +213,7 @@ GetVehicleDataRequest::~GetVehicleDataRequest() {
}
void GetVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "GetVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
@@ -260,7 +260,7 @@ void GetVehicleDataRequest::Run() {
}
void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "GetVehicleDataRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject message = event.smart_object();
switch (event.id()) {
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 d9087fdc61..5491e9b1aa 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
@@ -47,7 +47,7 @@ GetVehicleDataResponse::~GetVehicleDataResponse() {
}
void GetVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "GetVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 d0fa71d466..427443e3e9 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
@@ -50,7 +50,7 @@ ListFilesRequest::~ListFilesRequest() {
}
void ListFilesRequest::Run() {
- LOG4CXX_INFO(logger_, "ListFilesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
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 6ffbec1ac4..42bd1e6f07 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
@@ -47,7 +47,7 @@ ListFilesResponse::~ListFilesResponse() {
}
void ListFilesResponse::Run() {
- LOG4CXX_INFO(logger_, "ListFilesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 ebd0d6aac1..e3e51faa6e 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
@@ -47,7 +47,7 @@ OnAppInterfaceUnregisteredNotification::~OnAppInterfaceUnregisteredNotification(
}
void OnAppInterfaceUnregisteredNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAppInterfaceUnregisteredNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 2515f591b1..d1329bf8ea 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
@@ -45,7 +45,7 @@ OnAudioPassThruNotification::~OnAudioPassThruNotification() {
}
void OnAudioPassThruNotification::Run() {
- LOG4CXX_INFO(logger_, "OnAudioPassThruNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 55b9b8818d..62cf11d76d 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
@@ -51,7 +51,7 @@ OnButtonEventNotification::~OnButtonEventNotification() {
}
void OnButtonEventNotification::Run() {
- LOG4CXX_INFO(logger_, "OnButtonEventNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const uint32_t btn_id =
static_cast<uint32_t>(
@@ -124,18 +124,19 @@ void OnButtonEventNotification::Run() {
}
void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
- smart_objects::SmartObject* on_btn_event = new smart_objects::SmartObject();
-
- if (!on_btn_event) {
+ if (!app) {
LOG4CXX_ERROR_EXT(logger_, "OnButtonEvent NULL pointer");
return;
}
- if (!app) {
+ smart_objects::SmartObjectSPtr on_btn_event = new smart_objects::SmartObject();
+
+ if (!on_btn_event) {
LOG4CXX_ERROR_EXT(logger_, "OnButtonEvent NULL pointer");
return;
}
+
(*on_btn_event)[strings::params][strings::connection_key] = app->app_id();
(*on_btn_event)[strings::params][strings::function_id] =
@@ -152,7 +153,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
- message_.reset(on_btn_event);
+ message_ = on_btn_event;
SendNotification();
}
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 cfafc7af1c..86fe664f86 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
@@ -51,7 +51,7 @@ OnButtonPressNotification::~OnButtonPressNotification() {
}
void OnButtonPressNotification::Run() {
- LOG4CXX_INFO(logger_, "OnButtonPressNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const uint32_t btn_id =
static_cast<uint32_t>(
@@ -124,18 +124,19 @@ void OnButtonPressNotification::Run() {
}
void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
- smart_objects::SmartObject* on_btn_press = new smart_objects::SmartObject();
-
- if (!on_btn_press) {
+ if (!app) {
LOG4CXX_ERROR_EXT(logger_, "OnButtonPress NULL pointer");
return;
}
- if (!app) {
+ smart_objects::SmartObjectSPtr on_btn_press = new smart_objects::SmartObject();
+
+ if (!on_btn_press) {
LOG4CXX_ERROR_EXT(logger_, "OnButtonPress NULL pointer");
return;
}
+
(*on_btn_press)[strings::params][strings::connection_key] = app->app_id();
(*on_btn_press)[strings::params][strings::function_id] =
@@ -152,7 +153,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
- message_.reset(on_btn_press);
+ message_ = on_btn_press;
SendNotification();
}
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 8342d05a45..9bba1851f6 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
@@ -47,7 +47,7 @@ OnCommandNotification::~OnCommandNotification() {
}
void OnCommandNotification::Run() {
- LOG4CXX_INFO(logger_, "OnCommandNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::msg_params][strings::app_id].asInt());
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 fc92c17e94..e9145520f4 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
@@ -51,7 +51,7 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {
}
void OnDriverDistractionNotification::Run() {
- LOG4CXX_INFO(logger_, "OnDriverDistractionNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 b9ee1339bb..10f3eb1ab6 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
@@ -37,7 +37,6 @@
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include <string>
-#include <sstream>
namespace application_manager {
@@ -54,7 +53,7 @@ OnHashChangeNotification::~OnHashChangeNotification() {
}
void OnHashChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnHashChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
@@ -62,10 +61,13 @@ void OnHashChangeNotification::Run() {
int32_t app_id;
app_id = (*message_)[strings::params][strings::connection_key].asInt();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
- std::stringstream stream;
- stream << app->curHash();
- (*message_)[strings::msg_params][strings::hash_id] = stream.str();
- SendNotification();
+ 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");
+ }
+
}
} //namespace mobile
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 9c03c0f623..e4a2d7c340 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
@@ -49,16 +49,17 @@ OnHMIStatusNotification::~OnHMIStatusNotification() {
}
void OnHMIStatusNotification::Run() {
- LOG4CXX_INFO(logger_, "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(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ connection_key());
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist");
return;
}
+
mobile_apis::HMILevel::eType hmi_level =
static_cast<mobile_apis::HMILevel::eType>(
(*message_)[strings::msg_params][strings::hmi_level].asInt());
@@ -74,7 +75,8 @@ void OnHMIStatusNotification::Run() {
(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");
+ LOG4CXX_INFO(logger_,
+ "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList");
ApplicationManagerImpl::instance()->AddAppToTTSGlobalPropertiesList(
app->app_id());
}
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
new file mode 100644
index 0000000000..443175a5ee
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
@@ -0,0 +1,81 @@
+/*
+
+ 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_hmi_status_notification_from_mobile.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/message.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace application_manager {
+namespace commands {
+
+bool OnHMIStatusNotificationFromMobile::is_apps_requested_ = false;
+
+OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile(
+ const MessageSharedPtr& message)
+ : CommandNotificationFromMobileImpl(message) {
+}
+
+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());
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_,
+ "OnHMIStatusNotificationFromMobile application doesn't exist");
+ return;
+ }
+
+ // In case if this notification will be received from mobile side, it will
+ // mean, that app is in foreground on mobile. This should trigger remote
+ // apps list query for SDL 4.0 app
+ if (is_apps_requested_) {
+ LOG4CXX_DEBUG(logger_, "Remote apps list had been requested already.");
+ return;
+ }
+ if (ProtocolVersion::kV4 == app->protocol_version()) {
+ MessageHelper::SendQueryApps(connection_key());
+ is_apps_requested_ = true;
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
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 969885ab16..b8c6d6f114 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
@@ -51,7 +51,7 @@ OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {
}
void OnKeyBoardInputNotification::Run() {
- LOG4CXX_INFO(logger_, "OnKeyBoardInputNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const std::vector<ApplicationSharedPtr>& applications =
ApplicationManagerImpl::instance()->applications_with_navi();
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 f550df8748..43b1b5b921 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
@@ -46,7 +46,7 @@ OnLanguageChangeNotification::~OnLanguageChangeNotification() {
}
void OnLanguageChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnLanguageChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
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 37c81085eb..62ea1af1fc 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
@@ -48,7 +48,7 @@ OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {
}
void OnPermissionsChangeNotification::Run() {
- LOG4CXX_INFO(logger_, "OnPermissionsChangeNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
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 ebf98cd7e8..7e5c381bef 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
@@ -50,7 +50,7 @@ OnSystemRequestNotification::~OnSystemRequestNotification() {
}
void OnSystemRequestNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSystemRequestNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::RequestType::eType request_type = static_cast<mobile_apis::RequestType::eType>
((*message_)[strings::msg_params][strings::request_type].asInt());
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 05494c6144..99a5d665db 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
@@ -49,7 +49,7 @@ OnTBTClientStateNotification::~OnTBTClientStateNotification() {
}
void OnTBTClientStateNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTBTClientStateNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
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 250faa8f38..6db54289eb 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
@@ -50,7 +50,7 @@ OnTouchEventNotification::~OnTouchEventNotification() {
}
void OnTouchEventNotification::Run() {
- LOG4CXX_INFO(logger_, "OnTouchEventNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const std::vector<ApplicationSharedPtr>& applications =
ApplicationManagerImpl::instance()->applications_with_navi();
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 420c42f30c..044bb16b40 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
@@ -50,7 +50,7 @@ OnVehicleDataNotification::~OnVehicleDataNotification() {
}
void OnVehicleDataNotification::Run() {
- LOG4CXX_INFO(logger_, "OnVehicleDataNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
VehicleData::const_iterator it = vehicle_data.begin();
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 a730995f5d..b3d57d6be0 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
@@ -55,7 +55,7 @@ PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {
}
void PerformAudioPassThruRequest::onTimeOut() {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::onTimeOut");
+ LOG4CXX_AUTO_TRACE(logger_);
if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) {
ApplicationManagerImpl::instance()->StopAudioPassThru(connection_key());
@@ -73,7 +73,7 @@ bool PerformAudioPassThruRequest::Init() {
}
void PerformAudioPassThruRequest::Run() {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -111,7 +111,7 @@ void PerformAudioPassThruRequest::Run() {
}
void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -177,8 +177,10 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
void PerformAudioPassThruRequest::SendSpeakRequest() {
// crate HMI TTS speak request
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ using namespace hmi_apis;
+ using namespace smart_objects;
+
+ SmartObject msg_params = smart_objects::SmartObject(SmartType_Map);
if ((*message_)[str::msg_params].keyExists(str::initial_prompt) &&
(0 < (*message_)[str::msg_params][str::initial_prompt].length())) {
@@ -192,8 +194,9 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
}
// app_id
msg_params[strings::app_id] = connection_key();
+ msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU;
is_active_tts_speak_ = true;
- SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true);
+ SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true);
}
}
@@ -260,7 +263,7 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() {
}
bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
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 a10eaac9f3..585383889d 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
@@ -48,7 +48,7 @@ PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {
}
void PerformAudioPassThruResponse::Run() {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 12514626a6..949fcab015 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
@@ -49,11 +49,11 @@ namespace commands {
PerformInteractionRequest::PerformInteractionRequest(
const MessageSharedPtr& message)
: CommandRequestImpl(message),
- timer_("PerformInteractionReq", this, &PerformInteractionRequest::onTimer),
vr_perform_interaction_code_(mobile_apis::Result::INVALID_ENUM),
interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM),
- ui_response_recived(false),
- vr_response_recived(false) {
+ ui_response_recived_(false),
+ vr_response_recived_(false),
+ app_pi_was_active_before_(false) {
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand);
@@ -63,10 +63,6 @@ PerformInteractionRequest::PerformInteractionRequest(
PerformInteractionRequest::~PerformInteractionRequest() {
}
-void PerformInteractionRequest::onTimer() {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::onTimer");
-}
-
bool PerformInteractionRequest::Init() {
/* Timeout in milliseconds.
@@ -75,19 +71,19 @@ bool PerformInteractionRequest::Init() {
default_timeout_ =
(*message_)[strings::msg_params][strings::timeout].asUInt();
}
- mobile_apis::InteractionMode::eType mode =
- static_cast<mobile_apis::InteractionMode::eType>(
+
+ interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>(
(*message_)[strings::msg_params][strings::interaction_mode].asInt());
- if (mobile_apis::InteractionMode::BOTH == mode ||
- mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- default_timeout_ *= 2;
- }
+ if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
+ mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ default_timeout_ *= 2;
+ }
return true;
}
void PerformInteractionRequest::Run() {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -98,52 +94,51 @@ void PerformInteractionRequest::Run() {
return;
}
+ if (app->is_perform_interaction_active()) {
+ LOG4CXX_INFO(logger_, "Application has active PerformInteraction");
+ app_pi_was_active_before_ = true;
+ }
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
mobile_apis::LayoutMode::eType interaction_layout =
mobile_apis::LayoutMode::INVALID_ENUM;
- if ((*message_)[strings::msg_params].keyExists(
- hmi_request::interaction_layout)) {
+
+ if (msg_params.keyExists(hmi_request::interaction_layout)) {
interaction_layout = static_cast<mobile_apis::LayoutMode::eType>(
- (*message_)[strings::msg_params][hmi_request::interaction_layout].asInt());
+ msg_params[hmi_request::interaction_layout].asInt());
}
- if ((mobile_apis::InteractionMode::VR_ONLY ==
- static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt())) &&
+ 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_EXT(logger_, "PerformInteraction contains InteractionMode"
+ "=VR_ONLY and interactionLayout=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- if ((0 == (*message_)
- [strings::msg_params][strings::interaction_choice_set_id_list].length()) &&
- (mobile_apis::InteractionMode::BOTH ==
- static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt()))) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "interactionChoiceSetIDList is empty and InteractionMode=BOTH");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
+ const size_t choice_set_id_list_length =
+ msg_params[strings::interaction_choice_set_id_list].length();
- if ((0 == (*message_)
- [strings::msg_params][strings::interaction_choice_set_id_list].length()) &&
- (mobile_apis::LayoutMode::KEYBOARD != interaction_layout)) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "interactionChoiceSetIDList is empty and without parameter"
- "interactionLayout=KEYBOARD");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
+ 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");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+ } else {
+ LOG4CXX_ERROR_EXT(logger_,"interactionChoiceSetIDList is empty"
+ " and interactionLayout!=KEYBOARD");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
}
- if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
+ if (msg_params.keyExists(strings::vr_help)) {
if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems(
- (*message_)[strings::msg_params][strings::vr_help], app)) {
+ msg_params[strings::vr_help], app)) {
LOG4CXX_ERROR_EXT(
logger_,
"MessageHelper::VerifyImageVrHelpItems return INVALID_DATA!");
@@ -153,7 +148,7 @@ void PerformInteractionRequest::Run() {
}
smart_objects::SmartObject& choice_list =
- (*message_)[strings::msg_params][strings::interaction_choice_set_id_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())) {
@@ -170,67 +165,31 @@ void PerformInteractionRequest::Run() {
return;
}
- int32_t mode =
- (*message_)[strings::msg_params][strings::interaction_mode].asInt();
-
- app->set_perform_interaction_mode(mode);
-
- interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>(mode);
-
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
LOG4CXX_INFO(logger_, "Interaction Mode: BOTH");
- if (!CheckChoiceSetVRSynonyms(app)) {
- return;
- }
-
- if (!CheckChoiceSetMenuNames(app)) {
+ if (!CheckChoiceSetVRSynonyms(app) ||
+ !CheckChoiceSetMenuNames(app) ||
+ !CheckVrHelpItemPositions(app)) {
return;
}
-
- if (!CheckVrHelpItemPositions(app)) {
- return;
- }
-
- app->set_perform_interaction_active(correlation_id());
- SendVRPerformInteractionRequest(app);
- SendUIPerformInteractionRequest(app);
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
LOG4CXX_INFO(logger_, "Interaction Mode: MANUAL_ONLY");
-
- if (!CheckChoiceSetVRSynonyms(app)) {
- return;
- }
-
- if (!CheckChoiceSetMenuNames(app)) {
- return;
- }
-
- if (!CheckVrHelpItemPositions(app)) {
+ if (!CheckChoiceSetVRSynonyms(app) ||
+ !CheckChoiceSetMenuNames(app) ||
+ !CheckVrHelpItemPositions(app)) {
return;
}
-
- app->set_perform_interaction_active(correlation_id());
- SendVRPerformInteractionRequest(app);
- SendUIPerformInteractionRequest(app);
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
LOG4CXX_INFO(logger_, "Interaction Mode: VR_ONLY");
- if (!CheckChoiceSetVRSynonyms(app)) {
- return;
- }
-
- if (!CheckVrHelpItemPositions(app)) {
+ if (!CheckChoiceSetVRSynonyms(app) ||
+ !CheckVrHelpItemPositions(app)) {
return;
}
-
- // TODO(DK): need to implement timeout
- app->set_perform_interaction_active(correlation_id());
- SendVRPerformInteractionRequest(app);
- SendUIPerformInteractionRequest(app);
break;
}
default: {
@@ -239,27 +198,32 @@ void PerformInteractionRequest::Run() {
}
}
- // TODO(DK): need to implement timeout TTS speak request.
+ app->set_perform_interaction_mode(static_cast<int32_t>(interaction_mode_));
+ app->set_perform_interaction_active(true);
+ SendVRPerformInteractionRequest(app);
+ SendUIPerformInteractionRequest(app);
}
void PerformInteractionRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
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());
+ correlation_id(),
+ default_timeout());
break;
}
case hmi_apis::FunctionID::UI_PerformInteraction: {
LOG4CXX_INFO(logger_, "Received UI_PerformInteraction event");
+ ui_response_recived_ = true;
ProcessPerformInteractionResponse(event.smart_object());
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
- LOG4CXX_INFO(logger_, "Received TTS_PerformInteraction");
+ LOG4CXX_INFO(logger_, "Received VR_PerformInteraction");
+ vr_response_recived_ = true;
ProcessVRResponse(event.smart_object());
break;
}
@@ -271,11 +235,11 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
void PerformInteractionRequest::onTimeOut() {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::onTimeOut");
+ LOG4CXX_AUTO_TRACE(logger_);
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
- if (true == vr_response_recived) {
+ if (true == vr_response_recived_) {
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
CommandRequestImpl::onTimeOut();
@@ -308,37 +272,56 @@ void PerformInteractionRequest::onTimeOut() {
void PerformInteractionRequest::ProcessVRResponse(
const smart_objects::SmartObject& message) {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::ProcessVRResponse");
- const uint32_t app_id = connection_key();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ using namespace mobile_apis::Result;
+ using namespace smart_objects;
+
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
if (!app.get()) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- vr_response_recived = true;
- vr_perform_interaction_code_ = static_cast<mobile_apis::Result::eType>(
+ vr_perform_interaction_code_ = static_cast<eType>(
message[strings::params][hmi_response::code].asInt());
- if (mobile_apis::Result::ABORTED == vr_perform_interaction_code_ ||
- mobile_apis::Result::TIMED_OUT == vr_perform_interaction_code_) {
+ if (ABORTED == vr_perform_interaction_code_ ||
+ TIMED_OUT == vr_perform_interaction_code_) {
LOG4CXX_INFO(logger_, "VR response aborted");
- if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
+ if (InteractionMode::VR_ONLY == interaction_mode_) {
LOG4CXX_INFO(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());
+ ApplicationManagerImpl::instance()->
+ updateRequestTimeout(connection_key(),
+ correlation_id(),
+ default_timeout());
return;
}
}
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- smart_objects::SmartObject* ptr_msg_params = NULL;
+ if (REJECTED == vr_perform_interaction_code_) {
+ LOG4CXX_INFO(logger_, "VR had been rejected.");
+ TerminatePerformInteraction();
+ SendResponse(false, vr_perform_interaction_code_);
+ return;
+ }
+
+ if (SUCCESS == vr_perform_interaction_code_ &&
+ InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ LOG4CXX_INFO(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())) {
@@ -348,22 +331,21 @@ void PerformInteractionRequest::ProcessVRResponse(
} else {
LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
TerminatePerformInteraction();
- SendResponse(false, mobile_apis::Result::GENERIC_ERROR,
- "Wrong choiceID was received from HMI");
+ SendResponse(false, GENERIC_ERROR,"Wrong choiceID was received from HMI");
return;
}
}
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
- if (mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- vr_perform_interaction_code_) {
+ eType result_code = INVALID_ENUM;
+
+ if (UNSUPPORTED_RESOURCE == vr_perform_interaction_code_) {
LOG4CXX_INFO(logger_, "VR response WARNINGS");
- result_code = mobile_apis::Result::WARNINGS;
+ result_code = WARNINGS;
} else {
LOG4CXX_INFO(logger_, "VR response SUCCESS");
- result_code = mobile_apis::Result::SUCCESS;
+ result_code = SUCCESS;
msg_params[strings::trigger_source] =
- static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR);
+ static_cast<int32_t>(TriggerSource::TS_VR);
ptr_msg_params = &msg_params;
}
TerminatePerformInteraction();
@@ -372,60 +354,57 @@ void PerformInteractionRequest::ProcessVRResponse(
void PerformInteractionRequest::ProcessPerformInteractionResponse(
const smart_objects::SmartObject& message) {
- LOG4CXX_INFO(logger_,
- "PerformInteractionRequest::ProcessPerformInteractionResponse");
- const uint32_t app_id = connection_key();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app.get()) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- ui_response_recived = true;
+
+ bool result = false;
+ std::string info;
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params = message[strings::msg_params];
- bool result = false;
mobile_apis::Result::eType result_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt()));
- if ((mobile_apis::Result::SUCCESS == result_code) ||
- (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code)) {
- if (message[strings::msg_params].keyExists(strings::choice_id) &&
- !(CheckChoiceIDFromResponse(
- app, message[strings::msg_params][strings::choice_id].asInt()))) {
- DisablePerformInteraction();
- SendResponse(false, mobile_apis::Result::GENERIC_ERROR,
- "Wrong choiceID was received from HMI");
- return;
- }
- if (message[strings::msg_params].keyExists(strings::manual_text_entry)) {
- msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_KEYBOARD;
- } else {
- msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_MENU;
- }
- DisablePerformInteraction();
+ if (mobile_apis::Result::SUCCESS == result_code) {
+ result = true;
+ }
+
+ if (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) {
result = true;
- } else if (mobile_apis::Result::REJECTED == result_code) {
- LOG4CXX_ERROR(logger_, "Request was rejected");
+ result_code = mobile_apis::Result::WARNINGS;
+ info = "Unsupported phoneme type was sent in an item";
}
- const char* return_info = NULL;
if (result) {
- if (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) {
- result_code = mobile_apis::Result::WARNINGS;
- return_info =
- std::string("Unsupported phoneme type sent in any item").c_str();
+ // 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;
+ info = "Wrong choiceID was received from HMI";
+ } else {
+ msg_params = message[strings::msg_params];
+ msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_MENU;
+ if (message[strings::msg_params].keyExists(strings::manual_text_entry)) {
+ msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_KEYBOARD;
+ }
+ }
}
}
- if (mobile_apis::Result::TIMED_OUT == result_code) {
- DisablePerformInteraction();
- }
+ DisablePerformInteraction();
- SendResponse(result, result_code, return_info, &(msg_params));
+ const char* return_info = (info.empty()) ? NULL : info.c_str();
+ const smart_objects::SmartObject* response_params = (msg_params.empty()) ? NULL : &msg_params;
+ SendResponse(result, result_code, return_info, response_params);
}
void PerformInteractionRequest::SendUIPerformInteractionRequest(
@@ -565,6 +544,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
smart_objects::SmartObject item(smart_objects::SmartType_Map);
// 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();
msg_params[strings::help_prompt][index++] = item;
@@ -744,15 +724,16 @@ void PerformInteractionRequest::DisablePerformInteraction() {
return;
}
- if (app->is_perform_interaction_active()) {
- app->set_perform_interaction_active(0);
+ if (app->is_perform_interaction_active() &&
+ (!app_pi_was_active_before_)) {
+ app->set_perform_interaction_active(false);
app->set_perform_interaction_mode(-1);
app->DeletePerformInteractionChoiceSetMap();
}
}
bool PerformInteractionRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::initial_text].asCharArray();
@@ -847,9 +828,10 @@ void PerformInteractionRequest::TerminatePerformInteraction() {
bool PerformInteractionRequest::CheckChoiceIDFromResponse(
ApplicationSharedPtr app, int32_t choice_id) {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::CheckChoiceIDFromResponse");
- const PerformChoiceSetMap& choice_set_map = app
- ->performinteraction_choice_set_map();
+ LOG4CXX_AUTO_TRACE(logger_);
+ const DataAccessor<PerformChoiceSetMap> accessor =
+ app->performinteraction_choice_set_map();
+ const PerformChoiceSetMap& choice_set_map = accessor.GetData();
for (PerformChoiceSetMap::const_iterator it = choice_set_map.begin();
choice_set_map.end() != it; ++it) {
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 4ceb4ce3b3..59d706926d 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
@@ -47,7 +47,7 @@ PerformInteractionResponse::~PerformInteractionResponse() {
}
void PerformInteractionResponse::Run() {
- LOG4CXX_INFO(logger_, "PerformInteractionResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 1da7e08e47..88743e3668 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
@@ -55,7 +55,7 @@ PutFileRequest::~PutFileRequest() {
}
void PutFileRequest::Run() {
- LOG4CXX_INFO(logger_, "PutFileRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -224,7 +224,7 @@ void PutFileRequest::Run() {
break;
}
default:
- LOG4CXX_INFO(logger_, "Save in unsuccessful. Result = " << save_result);
+ LOG4CXX_WARN(logger_, "Save in unsuccessful. Result = " << save_result);
SendResponse(false, save_result, "Can't save file", &response_params);
break;
}
@@ -232,7 +232,7 @@ void PutFileRequest::Run() {
void PutFileRequest::SendOnPutFileNotification() {
LOG4CXX_INFO(logger_, "SendOnPutFileNotification" );
- smart_objects::SmartObject* notification = new smart_objects::SmartObject(
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
smart_objects::SmartType_Map);
smart_objects::SmartObject& message = *notification;
@@ -250,7 +250,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(&message);
+ ApplicationManagerImpl::instance()->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 4ab950d7a8..52598fda16 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
@@ -48,7 +48,7 @@ PutFileResponse::~PutFileResponse() {
}
void PutFileResponse::Run() {
- LOG4CXX_INFO(logger_, "PutFileResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = (*message_)[strings::params][strings::connection_key]
.asUInt();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
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 1de080df4c..5a066aab4d 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
@@ -49,7 +49,7 @@ ReadDIDRequest::~ReadDIDRequest() {
}
void ReadDIDRequest::Run() {
- LOG4CXX_INFO(logger_, "ReadDIDRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = (*message_)[strings::params][strings::connection_key]
.asUInt();
@@ -96,7 +96,7 @@ void ReadDIDRequest::Run() {
}
void ReadDIDRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ReadDIDRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc
index 888b590758..1133fe89ed 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
@@ -46,7 +46,7 @@ ReadDIDResponse::~ReadDIDResponse() {
}
void ReadDIDResponse::Run() {
- LOG4CXX_INFO(logger_, "ReadDIDResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 f62e0d4b84..0c4070611c 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
@@ -1,6 +1,6 @@
-/*
+/*
- 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
@@ -116,6 +116,18 @@ struct CheckMissedTypes {
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());
+ }
+
+private:
+ const std::string& app_id_;
+};
}
namespace application_manager {
@@ -124,14 +136,15 @@ namespace commands {
RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
+ : CommandRequestImpl(message),
+ result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {
}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {
}
bool RegisterAppInterfaceRequest::Init() {
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::Init");
+ LOG4CXX_AUTO_TRACE(logger_);
return true;
}
@@ -139,8 +152,9 @@ void RegisterAppInterfaceRequest::Run() {
LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::Run " << connection_key());
// Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
- // Flag conditional compilation "CUSTOMER_PASA" is used in order to exclude hit code
+ // Flag conditional compilation specific to customer is used in order to exclude hit code
// to RTC
+ // FIXME(EZamakhov): on shutdown - get freez
if (true == profile::Profile::instance()->launch_hmi()) {
// wait till HMI started
while (!ApplicationManagerImpl::instance()->IsHMICooperating()) {
@@ -189,13 +203,6 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- mobile_apis::Result::eType restriction_result = CheckRestrictions();
- if (mobile_apis::Result::SUCCESS != restriction_result) {
- LOG4CXX_ERROR_EXT(logger_, "Param names restrictions check failed.");
- SendResponse(false, restriction_result);
- return;
- }
-
if (IsWhiteSpaceExist()) {
LOG4CXX_INFO(logger_,
"Incoming register app interface has contains \t\n \\t \\n");
@@ -254,7 +261,7 @@ void RegisterAppInterfaceRequest::Run() {
if (mobile_apis::AppHMIType::NAVIGATION ==
static_cast<mobile_apis::AppHMIType::eType>(
app_type.getElement(i).asUInt())) {
- app->set_allowed_support_navigation(true);
+ app->set_is_navi(true);
}
if (mobile_apis::AppHMIType::COMMUNICATION ==
static_cast<mobile_apis::AppHMIType::eType>(
@@ -281,38 +288,12 @@ void RegisterAppInterfaceRequest::Run() {
device_info);
SendRegisterAppInterfaceResponseToMobile();
-
- MessageHelper::SendLockScreenIconUrlNotification(
- (*message_)[strings::params][strings::connection_key].asInt());
-
- policy::PolicyHandler::instance()->PTExchangeAtRegistration(mobile_app_id);
- }
-}
-
-void RegisterAppInterfaceRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::on_event");
- switch (event.id()) {
- case hmi_apis::FunctionID::TTS_Speak: {
- const smart_objects::SmartObject& message = event.smart_object();
-
- mobile_apis::Result::eType tts_result =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
- SendRegisterAppInterfaceResponseToMobile(tts_result);
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
- break;
- }
}
}
void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
mobile_apis::Result::eType result) {
- smart_objects::SmartObject* params = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance();
const HMICapabilities& hmi_capabilities = app_manager->hmi_capabilities();
@@ -320,14 +301,12 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(key);
- if (!application.valid()) {
+ if (!application) {
LOG4CXX_ERROR(logger_, "There is no application for such connection key" <<
key);
return;
}
- smart_objects::SmartObject& response_params = *params;
-
response_params[strings::sync_msg_version][strings::major_version] =
APIVersion::kAPIV3;
response_params[strings::sync_msg_version][strings::minor_version] =
@@ -467,17 +446,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller();
- uint32_t hash_id = 0;
+ std::string hash_id = "";
- const char* add_info = "";
- const bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id);
+ std::string add_info("");
+ bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id);
bool need_restore_vr = resumption;
if (resumption) {
- hash_id = (*message_)[strings::msg_params][strings::hash_id].asUInt();
+ hash_id = (*message_)[strings::msg_params][strings::hash_id].asString();
if (!resumer.CheckApplicationHash(application, hash_id)) {
- LOG4CXX_WARN(logger_, "Hash does not matches");
+ LOG4CXX_WARN(logger_, "Hash does not match");
result = mobile_apis::Result::RESUME_FAILED;
- add_info = "Hash does not matches";
+ add_info = "Hash does not match";
need_restore_vr = false;
} else if (!resumer.CheckPersistenceFilesForResumption(application)) {
LOG4CXX_WARN(logger_, "Persistent data is missed");
@@ -488,8 +467,16 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
add_info = " Resume Succeed";
}
}
+ if ((mobile_apis::Result::SUCCESS == result) &&
+ (mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) {
+ add_info += response_info_;
+ result = result_checking_app_hmi_type_;
+ }
- SendResponse(true, result, add_info, params);
+ // in case application exist in resumption we need to send resumeVrgrammars
+ if (false == resumption) {
+ resumption = resumer.IsApplicationSaved(application->mobile_app_id());
+ }
MessageHelper::SendOnAppRegisteredNotificationToHMI(*(application.get()),
resumption,
@@ -497,6 +484,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
MessageHelper::SendChangeRegistrationRequestToHMI(application);
+ SendResponse(true, result, add_info.c_str(), &response_params);
if (result != mobile_apis::Result::RESUME_FAILED) {
resumer.StartResumption(application, hash_id);
} else {
@@ -506,17 +494,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
mobile_apis::Result::eType
RegisterAppInterfaceRequest::CheckCoincidence() {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
- std::set<ApplicationSharedPtr>::const_iterator it = applications.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt it =
+ accessor.begin();
const std::string app_name = msg_params[strings::app_name].asString();
- for (; applications.end() != it; ++it) {
+ for (; accessor.end() != it; ++it) {
// name check
const std::string& cur_name = (*it)->name();
@@ -577,9 +565,10 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
}
if (!app_nicknames.empty()) {
- policy::StringArray::const_iterator it = std::find(
- app_nicknames.begin(), app_nicknames.end(),
+ IsSameNickname compare(
message[strings::msg_params][strings::app_name].asString());
+ policy::StringArray::const_iterator it = std::find_if(
+ app_nicknames.begin(), app_nicknames.end(), compare);
if (app_nicknames.end() == it) {
LOG4CXX_WARN(logger_,
"Application name was not found in nicknames list.");
@@ -608,7 +597,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
if (!log.empty()) {
response_info_ = "Following AppHMITypes are not present in policy "
"table:" + log;
- result = mobile_apis::Result::WARNINGS;
+ result_checking_app_hmi_type_ = mobile_apis::Result::WARNINGS;
}
}
// Replace AppHMITypes in request with values allowed by policy table
@@ -661,91 +650,22 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
}
}
-mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckRestrictions() const {
-
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::CheckRestrictions");
-
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
-
- const std::string& app_name = msg_params[strings::app_name].asString();
-
- if (ClearParamName(app_name).empty()) {
- printf("Application name is empty.\n");
- return mobile_apis::Result::INVALID_DATA;
- }
-
- if ((app_name[0] == '\n') ||
- ((app_name[0] == '\\') && (app_name[1] == 'n'))) {
-
- printf("Application name has invalid characters.");
- return mobile_apis::Result::INVALID_DATA;
- }
-
- if (msg_params.keyExists(strings::tts_name)) {
-
- const smart_objects::SmartArray* tts =
- msg_params[strings::tts_name].asArray();
-
- smart_objects::SmartArray::const_iterator it = tts->begin();
- smart_objects::SmartArray::const_iterator it_end = tts->end();
-
- for (; it != it_end; ++it) {
-
- const std::string& tts_name = (*it)[strings::text].asString();
-
- if (ClearParamName(tts_name).empty()) {
- printf("TTS value is empty.");
- return mobile_apis::Result::INVALID_DATA;
- }
-
- if ((tts_name[0] == '\n') ||
- ((tts_name[0] == '\\') && (tts_name[1] == 'n'))) {
-
- printf("TTS value(s) has invalid characters.");
- return mobile_apis::Result::INVALID_DATA;
- }
- }
- }
-
- return mobile_apis::Result::SUCCESS;
-}
-
-std::string
-RegisterAppInterfaceRequest::ClearParamName(std::string param_name) const {
-
- // Expecting for chars different from newlines and spaces in the appName
- //
- // There is an agreement, that "\n" is not allowed symbols, so we have to
- // check for this case also
-
- std::string newline = "\\n";
- while (std::string::npos != param_name.find(newline)) {
- param_name.erase(param_name.find(newline), newline.length());
- }
-
- std::string::iterator param_name_new_end =
- std::remove_if(param_name.begin(), param_name.end(), ::isspace);
-
- return std::string(param_name.begin(), param_name_new_end);
-}
-
bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::"
"IsApplicationWithSameAppIdRegistered");
const std::string mobile_app_id = (*message_)[strings::msg_params]
- [strings::app_id].asString();
+ [strings::app_id].asString();
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> applications = accessor.applications();
+ const ApplicationManagerImpl::ApplictionSet applications = accessor.applications();
- std::set<ApplicationSharedPtr>::const_iterator it = applications.begin();
- std::set<ApplicationSharedPtr>::const_iterator it_end = applications.end();
+ ApplicationManagerImpl::ApplictionSetConstIt it = applications.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt it_end = applications.end();
for (; it != it_end; ++it) {
- if (mobile_app_id == (*it)->mobile_app_id()->asString()) {
+ if (!strcasecmp(mobile_app_id.c_str(),(*it)->mobile_app_id().c_str())) {
return true;
}
}
@@ -754,7 +674,7 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
}
bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::app_name].asCharArray();
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 fe6f3a925a..25de8d3ef4 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
@@ -42,7 +42,7 @@ namespace application_manager {
namespace commands {
void RegisterAppInterfaceResponse::Run() {
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
bool success = (*message_)[strings::msg_params][strings::success].asBool();
@@ -67,7 +67,7 @@ void RegisterAppInterfaceResponse::Run() {
application(connection_key);
if (app.valid()) {
policy::PolicyHandler *policy_handler = policy::PolicyHandler::instance();
- std::string mobile_app_id = app->mobile_app_id()->asString();
+ std::string mobile_app_id = app->mobile_app_id();
policy_handler->AddApplication(mobile_app_id);
SetHeartBeatTimeout(connection_key, mobile_app_id);
}
@@ -75,10 +75,11 @@ void RegisterAppInterfaceResponse::Run() {
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
uint32_t connection_key, const std::string& mobile_app_id) {
- LOG4CXX_TRACE_ENTER(logger_);
+ 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);
+ const int32_t timeout = policy_handler->HeartBeatTimeout(mobile_app_id) /
+ date_time::DateTime::MILLISECONDS_IN_SECOND;
if (timeout > 0) {
application_manager::ApplicationManagerImpl::instance()->
connection_handler()->SetHeartBeatTimeout(connection_key, timeout);
@@ -86,7 +87,6 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
} else {
LOG4CXX_INFO(logger_, "Policy is turn off");
}
- LOG4CXX_TRACE_EXIT(logger_);
}
} // namespace commands
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 5e62b789d8..9f6e84b55b 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
@@ -58,7 +58,7 @@ ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {
}
void ResetGlobalPropertiesRequest::Run() {
- LOG4CXX_INFO(logger_, "ResetGlobalPropertiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
@@ -125,7 +125,7 @@ void ResetGlobalPropertiesRequest::Run() {
smart_objects::SmartType_Map);
if (vr_help_title_items) {
- smart_objects::SmartObject* vr_help = MessageHelper::CreateAppVrHelp(app);
+ smart_objects::SmartObjectSPtr vr_help = MessageHelper::CreateAppVrHelp(app);
if (!vr_help) {
return;
}
@@ -236,7 +236,7 @@ bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems(
}
void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ResetGlobalPropertiesRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc
index aeacabf9d5..8e562956ae 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
@@ -47,7 +47,7 @@ ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {
}
void ResetGlobalPropertiesResponse::Run() {
- LOG4CXX_INFO(logger_, "ResetGlobalPropertiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 5b3cfa67ac..10f080e0e7 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
@@ -68,7 +68,7 @@ bool ScrollableMessageRequest::Init() {
}
void ScrollableMessageRequest::Run() {
- LOG4CXX_INFO(logger_, "ScrollableMessageRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
->application((*message_)[strings::params][strings::connection_key].asUInt());
@@ -113,7 +113,7 @@ void ScrollableMessageRequest::Run() {
}
void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ScrollableMessageRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -133,8 +133,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
bool result = false;
- if (mobile_apis::Result::SUCCESS == result_code ||
- mobile_apis::Result::ABORTED == result_code) {
+ if (mobile_apis::Result::SUCCESS == result_code) {
result = true;
} else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) &&
hmi_capabilities.is_ui_cooperating()) {
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 d9692359d0..212a3ba912 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
@@ -46,7 +46,7 @@ ScrollableMessageResponse::ScrollableMessageResponse(
}
void ScrollableMessageResponse::Run() {
- LOG4CXX_INFO(logger_, "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 =
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 b5c2e8a9a5..b77b4afd0f 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
@@ -46,17 +46,39 @@ SendLocationRequest::~SendLocationRequest() {
}
void SendLocationRequest::Run() {
- LOG4CXX_INFO(logger_, "SendLocationRequest::Run");
+ using namespace hmi_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(
- logger_, "An application " << app->name() << " is not registered.");
+ LOG4CXX_ERROR_EXT(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;
+ if (msg_params.keyExists(strings::location_name)) {
+ fields_to_check.push_back(Common_TextFieldName::locationName);
+ }
+ if (msg_params.keyExists(strings::location_description)) {
+ fields_to_check.push_back(Common_TextFieldName::locationDescription);
+ }
+ if (msg_params.keyExists(strings::address_lines)) {
+ fields_to_check.push_back(Common_TextFieldName::addressLines);
+ }
+ if (msg_params.keyExists(strings::phone_number)) {
+ fields_to_check.push_back(Common_TextFieldName::phoneNumber);
+ }
+
+ if (!CheckHMICapabilities(fields_to_check)) {
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ return;
+ }
if (IsWhiteSpaceExist()) {
LOG4CXX_ERROR(logger_, "Strings contain invalid characters");
@@ -90,7 +112,10 @@ void SendLocationRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code = GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ 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;
}
@@ -161,6 +186,39 @@ bool SendLocationRequest::IsWhiteSpaceExist() {
return false;
}
+bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names) {
+ using namespace smart_objects;
+ using namespace hmi_apis;
+
+ ApplicationManagerImpl* instance = ApplicationManagerImpl::instance();
+ const HMICapabilities& hmi_capabilities = instance->hmi_capabilities();
+ if (!hmi_capabilities.is_ui_cooperating()) {
+ LOG4CXX_ERROR_EXT(logger_, "UI is not supported.");
+ return false;
+ }
+ const size_t size_before = fields_names.size();
+ 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 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 =
+ std::find(fields_names.begin(), fields_names.end(), filed_name);
+ if (it != fields_names.end()) {
+ fields_names.erase(it);
+ }
+ }
+ }
+ if (fields_names.size() == size_before) {
+ LOG4CXX_ERROR_EXT(logger_, "Some fields are not supported by capabilities");
+ return false;
+ }
+ return true;
+}
+
} // namespace commands
} // namespace application_manager
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 a13b67dc06..32756c999d 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
@@ -48,7 +48,7 @@ SendLocationResponse::~SendLocationResponse() {
}
void SendLocationResponse::Run() {
- LOG4CXX_INFO(logger_, "SendLocationResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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
new file mode 100644
index 0000000000..9851bce3f2
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
@@ -0,0 +1,235 @@
+/*
+
+ 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/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"
+
+namespace application_manager {
+
+namespace commands {
+
+SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message)
+ : CommandRequestImpl(message) {
+}
+
+SetAppIconRequest::~SetAppIconRequest() {
+}
+
+void SetAppIconRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ const std::string& sync_file_name =
+ (*message_)[strings::msg_params][strings::sync_file_name].asString();
+
+ std::string full_file_path =
+ file_system::CurrentWorkingDirectory() + "/" +
+ profile::Profile::instance()->app_storage_folder() + "/";
+ full_file_path += app->folder_name();
+ full_file_path += "/";
+ full_file_path += sync_file_name;
+
+ if (!file_system::FileExists(full_file_path)) {
+ LOG4CXX_ERROR(logger_, "No such file " << full_file_path);
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ CopyToIconStorage(full_file_path);
+
+ 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);
+
+// 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);
+
+ // for further use in on_event function
+ (*message_)[strings::msg_params][strings::sync_file_name] =
+ msg_params[strings::sync_file_name];
+
+ SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
+}
+
+void SetAppIconRequest::CopyToIconStorage(
+ const std::string& path_to_file) const {
+ if (!profile::Profile::instance()->enable_protocol_4()) {
+ LOG4CXX_WARN(logger_,
+ "Icon copying skipped, since protocol ver. 4 is not enabled.");
+ return;
+ }
+
+ std::vector<uint8_t> 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());
+ const uint64_t file_size = file_system::FileSize(path_to_file);
+ const uint64_t storage_size = static_cast<uint64_t>(
+ file_system::DirectorySize(icon_storage));
+ if (storage_max_size < (file_size + storage_size)) {
+ RemoveOldestIcons(icon_storage,
+ profile::Profile::instance()->
+ app_icons_amount_to_remove());
+ }
+ ApplicationConstSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->
+ application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Can't get application for connection key: "
+ << connection_key());
+ return;
+ }
+
+ const std::string icon_path =
+ icon_storage + "/" + app->mobile_app_id();
+ if (!file_system::CreateFile(icon_path)) {
+ LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path);
+ return;
+ }
+
+ if (!file_system::Write(icon_path, file_content)) {
+ LOG4CXX_ERROR(logger_, "Can't write icon: " << icon_path);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Icon was successfully copied from :" << path_to_file
+ << " to " << icon_path);
+
+ return;
+}
+
+void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
+ const uint32_t icons_amount) const {
+ if (!icons_amount) {
+ LOG4CXX_DEBUG(logger_,
+ "No icons will be deleted, since amount of files is zero.");
+ return;
+ }
+ 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) {
+ const std::string file_name = *it;
+ const std::string file_path = storage + "/" + file_name;
+ if (!file_system::FileExists(file_path)) {
+ continue;
+ }
+ const uint64_t time = file_system::GetFileModificationTime(file_path);
+ icon_modification_time[time] = file_name;
+ }
+
+ for (size_t counter = 0; counter < icons_amount; ++counter) {
+ const std::string file_name = icon_modification_time.begin()->second;
+ const std::string file_path = storage + "/" + file_name;
+ if (!file_system::DeleteFile(file_path)) {
+ LOG4CXX_DEBUG(logger_, "Error while deleting icon " << file_path);
+ }
+ LOG4CXX_DEBUG(logger_, "Old icon " << file_path
+ << " was deleted successfully.");
+ }
+}
+
+void SetAppIconRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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>(
+ message[strings::params][hmi_response::code].asInt());
+
+ bool result = mobile_apis::Result::SUCCESS == result_code;
+
+ if (result) {
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
+ if (!message_.valid() || !app.valid()) {
+ LOG4CXX_ERROR(logger_, "NULL pointer.");
+ return;
+ }
+
+ 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, &(message[strings::msg_params]));
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
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
new file mode 100644
index 0000000000..563490bd46
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc
@@ -0,0 +1,56 @@
+/*
+
+ 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/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() {
+}
+
+void SetAppIconResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
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 60a2583287..b59a631d8d 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
@@ -49,7 +49,7 @@ SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {
}
void SetDisplayLayoutRequest::Run() {
- LOG4CXX_INFO(logger_, "SetDisplayLayoutRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationConstSharedPtr app = ApplicationManagerImpl::instance()
->application(connection_key());
@@ -66,7 +66,7 @@ void SetDisplayLayoutRequest::Run() {
}
void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetDisplayLayoutRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc
index 51f8c1f35b..3844b3bf05 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
@@ -48,7 +48,7 @@ SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {
}
void SetDisplayLayoutResponse::Run() {
- LOG4CXX_INFO(logger_, "SetDisplayLayoutResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
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 f7216c818c..ff46e041ff 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
@@ -59,7 +59,7 @@ SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {
}
void SetGlobalPropertiesRequest::Run() {
- LOG4CXX_INFO(logger_, "SetGlobalPropertiesRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -197,7 +197,8 @@ void SetGlobalPropertiesRequest::Run() {
SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties,
&params, true);
} else if (!is_vr_help_title_present && !is_vr_help_present) {
- const CommandsMap& cmdMap = app->commands_map();
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& cmdMap = accessor.GetData();
CommandsMap::const_iterator command_it = cmdMap.begin();
int32_t index = 0;
@@ -304,7 +305,7 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder() {
}
void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetGlobalPropertiesRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(CommandRequestImpl::connection_key());
@@ -383,7 +384,7 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
}
bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "SetGlobalPropertiesRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str;
const smart_objects::SmartObject& msg_params =
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 5f0b62fb4d..759333385d 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
@@ -48,7 +48,7 @@ SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {
}
void SetGlobalPropertiesResponse::Run() {
- LOG4CXX_INFO(logger_, "SetGlobalPropertiesResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 c9b2eb5ef5..536bb755ed 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
@@ -49,7 +49,7 @@ SetMediaClockRequest::~SetMediaClockRequest() {
}
void SetMediaClockRequest::Run() {
- LOG4CXX_INFO(logger_, "SetMediaClockRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -81,7 +81,7 @@ void SetMediaClockRequest::Run() {
}
void SetMediaClockRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetMediaClockRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc
index 73923b0021..da6f204da4 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
@@ -47,7 +47,7 @@ SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {
}
void SetMediaClockTimerResponse::Run() {
- LOG4CXX_INFO(logger_, "SetMediaClockTimerResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
index f4e70c53ac..1e861d14ce 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
@@ -51,7 +51,7 @@ ShowConstantTBTRequest::~ShowConstantTBTRequest() {
}
void ShowConstantTBTRequest::Run() {
- LOG4CXX_INFO(logger_, "ShowConstantTBTRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -175,7 +175,7 @@ void ShowConstantTBTRequest::Run() {
void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ShowConstantTBTRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -206,7 +206,7 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
}
bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "ShowConstantTBTRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) {
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 d5539d148c..e45cd760df 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
@@ -48,7 +48,7 @@ ShowConstantTBTResponse::~ShowConstantTBTResponse() {
}
void ShowConstantTBTResponse::Run() {
- LOG4CXX_INFO(logger_, "ShowConstantTBTResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 eeef60101e..0a136e0ac2 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -50,7 +50,7 @@ ShowRequest::~ShowRequest() {
}
void ShowRequest::Run() {
- LOG4CXX_INFO(logger_, "ShowRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
->application(
@@ -216,7 +216,7 @@ void ShowRequest::Run() {
}
void ShowRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "ShowRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -251,7 +251,7 @@ void ShowRequest::on_event(const event_engine::Event& event) {
}
bool ShowRequest::CheckStringsOfShowRequest() {
- LOG4CXX_INFO(logger_, "ShowRequest::CheckStringsOfShowRequest");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str;
if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) {
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 1f9c59c6fc..0c46cdd83c 100644
--- a/src/components/application_manager/src/commands/mobile/show_response.cc
+++ b/src/components/application_manager/src/commands/mobile/show_response.cc
@@ -48,7 +48,7 @@ ShowResponse::~ShowResponse() {
}
void ShowResponse::Run() {
- LOG4CXX_INFO(logger_, "ShowResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 52f3c7dee7..78a9bb6aac 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -60,7 +60,7 @@ bool SliderRequest::Init() {
}
void SliderRequest::Run() {
- LOG4CXX_INFO(logger_, "SliderRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
application_manager::ApplicationManagerImpl::instance()->application(
@@ -110,7 +110,7 @@ void SliderRequest::Run() {
}
void SliderRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SliderRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
const event_engine::Event::EventID event_id = event.id();
@@ -131,18 +131,16 @@ void SliderRequest::on_event(const event_engine::Event& event) {
const int response_code =
message[strings::params][hmi_response::code].asInt();
-
smart_objects::SmartObject response_msg_params = message[strings::msg_params];
- if (response_code == hmi_apis::Common_Result::ABORTED) {
+ if (response_code == hmi_apis::Common_Result::ABORTED &&
+ message[strings::params][strings::data].keyExists(strings::slider_position)) {
//Copy slider_position info to msg_params section
- response_msg_params[strings::slider_position] =
+ response_msg_params[strings::slider_position] =
message[strings::params][strings::data][strings::slider_position];
}
const bool is_response_success =
- (mobile_apis::Result::SUCCESS == response_code) ||
- //Aborted has slider_position data
- (mobile_apis::Result::ABORTED == response_code);
+ (mobile_apis::Result::SUCCESS == response_code);
SendResponse(is_response_success,
mobile_apis::Result::eType(response_code),
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 bfb6b0a1e6..7f0c10b068 100644
--- a/src/components/application_manager/src/commands/mobile/slider_response.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_response.cc
@@ -46,7 +46,7 @@ SliderResponse::~SliderResponse() {
}
void SliderResponse::Run() {
- LOG4CXX_INFO(logger_, "SliderResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 de37e8b49e..b2f112a64a 100644
--- a/src/components/application_manager/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_request.cc
@@ -49,7 +49,7 @@ SpeakRequest::~SpeakRequest() {
}
void SpeakRequest::Run() {
- LOG4CXX_INFO(logger_, "SpeakRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
->application(connection_key());
@@ -70,13 +70,13 @@ void SpeakRequest::Run() {
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
(*message_)[strings::msg_params][hmi_request::speak_type] =
- hmi_apis::Common_SpeakType::SPEAK;
+ hmi_apis::Common_MethodName::SPEAK;
SendHMIRequest(hmi_apis::FunctionID::TTS_Speak,
&message_->getElement(strings::msg_params), true);
}
void SpeakRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SpeakRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
switch (event.id()) {
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
@@ -100,7 +100,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
void SpeakRequest::ProcessTTSSpeakResponse(
const smart_objects::SmartObject& message) {
- LOG4CXX_INFO(logger_, "SpeakRequest::ProcessTTSSpeakResponse");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
connection_key());
@@ -134,7 +134,7 @@ void SpeakRequest::ProcessTTSSpeakResponse(
}
bool SpeakRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "SpeakRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
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 92b85bbb84..d99b1d0952 100644
--- a/src/components/application_manager/src/commands/mobile/speak_response.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_response.cc
@@ -48,7 +48,7 @@ SpeakResponse::~SpeakResponse() {
}
void SpeakResponse::Run() {
- LOG4CXX_INFO(logger_, "SpeakResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 b6a4d8a28e..abd0662547 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
@@ -48,7 +48,7 @@ SubscribeButtonRequest::~SubscribeButtonRequest() {
}
void SubscribeButtonRequest::Run() {
- LOG4CXX_INFO(logger_, "SubscribeButtonRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
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 6253f8ca3d..a3452ef19f 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
@@ -46,7 +46,7 @@ SubscribeButtonResponse::~SubscribeButtonResponse() {
}
void SubscribeButtonResponse::Run() {
- LOG4CXX_INFO(logger_, "SubscribeButtonResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
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 35595c2df6..1640f0b497 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
@@ -84,7 +84,7 @@ namespace {
#endif // #ifdef HMI_DBUS_API
void SubscribeVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "SubscribeVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
CommandRequestImpl::connection_key());
@@ -172,7 +172,7 @@ void SubscribeVehicleDataRequest::Run() {
}
void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SubscribeVehicleDataRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
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 972a654188..c0554c62eb 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
@@ -48,7 +48,7 @@ SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {
}
void SubscribeVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "SubscribeVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 2765aad8d7..25fbe6e3fd 100644
--- a/src/components/application_manager/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/src/commands/mobile/system_request.cc
@@ -40,6 +40,8 @@ Copyright (c) 2013, Ford Motor Company
#include "interfaces/MOBILE_API.h"
#include "config_profile/profile.h"
#include "utils/file_system.h"
+#include "formatters/CFormatterJsonBase.hpp"
+#include "json/json.h"
namespace application_manager {
@@ -55,7 +57,7 @@ SystemRequest::~SystemRequest() {
}
void SystemRequest::Run() {
- LOG4CXX_INFO(logger_, "SystemRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -66,12 +68,14 @@ void SystemRequest::Run() {
return;
}
- mobile_apis::RequestType::eType request_type =
+ const mobile_apis::RequestType::eType request_type =
static_cast<mobile_apis::RequestType::eType>(
(*message_)[strings::msg_params][strings::request_type].asInt());
if (!(*message_)[strings::params].keyExists(strings::binary_data) &&
- mobile_apis::RequestType::PROPRIETARY == request_type) {
+ (mobile_apis::RequestType::PROPRIETARY == request_type ||
+ mobile_apis::RequestType::QUERY_APPS == request_type)) {
+
LOG4CXX_ERROR(logger_, "Binary data empty");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -83,6 +87,18 @@ void SystemRequest::Run() {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
}
+ if (mobile_apis::RequestType::QUERY_APPS == request_type) {
+ using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
+
+ smart_objects::SmartObject sm_object;
+ CFormatterJsonBase::jsonValueToObj(Json::Value(
+ std::string(binary_data.begin(),
+ binary_data.end())),
+ sm_object);
+ ApplicationManagerImpl::instance()->ProcessQueryApp(sm_object);
+ return;
+ }
+
std::string file_path = profile::Profile::instance()->system_files_path();
if (!file_system::CreateDirectoryRecursively(file_path)) {
LOG4CXX_ERROR(logger_, "Cann't create folder.");
@@ -125,7 +141,7 @@ void SystemRequest::Run() {
}
if (mobile_apis::RequestType::PROPRIETARY != request_type) {
- msg_params[strings::app_id] = (application->mobile_app_id())->asString();
+ msg_params[strings::app_id] = (application->mobile_app_id());
}
msg_params[strings::request_type] =
(*message_)[strings::msg_params][strings::request_type];
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 e77ab08450..8b4fdafd1b 100644
--- a/src/components/application_manager/src/commands/mobile/system_response.cc
+++ b/src/components/application_manager/src/commands/mobile/system_response.cc
@@ -46,7 +46,7 @@ SystemResponse::~SystemResponse() {
}
void SystemResponse::Run() {
- LOG4CXX_INFO(logger_, "SystemResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 a07cfcd8f0..6199818dbe 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
@@ -40,7 +40,7 @@ namespace application_manager {
namespace commands {
void UnregisterAppInterfaceRequest::Run() {
- LOG4CXX_INFO(logger_, "UnregisterAppInterfaceRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance();
diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc
index 8ef0eb3ed0..49d9276d35 100644
--- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc
+++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc
@@ -38,7 +38,7 @@ namespace application_manager {
namespace commands {
void UnregisterAppInterfaceResponse::Run() {
- LOG4CXX_INFO(logger_, "UnregisterAppInterfaceResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendResponse((*message_)[strings::msg_params][strings::success].asBool());
}
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 f22d1c0a2f..08a27dedfa 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
@@ -50,7 +50,7 @@ UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {
}
void UnsubscribeButtonRequest::Run() {
- LOG4CXX_INFO(logger_, "UnsubscribeButtonRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[str::params][str::connection_key].asUInt());
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 1331eac27f..8bece66157 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
@@ -47,7 +47,7 @@ UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {
}
void UnsubscribeButtonResponse::Run() {
- LOG4CXX_INFO(logger_, "UnsubscribeButtonResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
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 fc7145078f..7d05ce328f 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
@@ -88,7 +88,7 @@ namespace {
#endif // #ifdef HMI_DBUS_API
void UnsubscribeVehicleDataRequest::Run() {
- LOG4CXX_INFO(logger_, "UnsubscribeVehicleDataRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
CommandRequestImpl::connection_key());
@@ -176,7 +176,7 @@ void UnsubscribeVehicleDataRequest::Run() {
}
void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "UnsubscribeVehicleDataRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
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 60f7077da7..87b2e6e5e1 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
@@ -45,7 +45,7 @@ UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {
}
void UnsubscribeVehicleDataResponse::Run() {
- LOG4CXX_INFO(logger_, "UnsubscribeVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
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 9447772568..650e698bf4 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
@@ -51,7 +51,7 @@ UpdateTurnListRequest::~UpdateTurnListRequest() {
}
void UpdateTurnListRequest::Run() {
- LOG4CXX_INFO(logger_, "UpdateTurnListRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
(*message_)[strings::params][strings::connection_key].asUInt());
@@ -141,7 +141,7 @@ void UpdateTurnListRequest::Run() {
}
void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "UpdateTurnListRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -188,7 +188,7 @@ bool UpdateTurnListRequest::CheckTurnListArray() {
}
bool UpdateTurnListRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "UpdateTurnListRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) {
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 ec1e0bce8a..26e5c460d3 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
@@ -47,7 +47,7 @@ UpdateTurnListResponse::~UpdateTurnListResponse() {
}
void UpdateTurnListResponse::Run() {
- LOG4CXX_INFO(logger_, "UpdateTurnListResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/src/event_engine/event.cc b/src/components/application_manager/src/event_engine/event.cc
index e454025df1..561e8a841f 100644
--- a/src/components/application_manager/src/event_engine/event.cc
+++ b/src/components/application_manager/src/event_engine/event.cc
@@ -48,7 +48,7 @@ void Event::raise() {
EventDispatcher::instance()->raise_event(*this);
}
-void Event::set_smart_object(smart_objects::SmartObject& so) {
+void Event::set_smart_object(const smart_objects::SmartObject& so) {
response_so_ = so;
}
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher.cc b/src/components/application_manager/src/event_engine/event_dispatcher.cc
index a552ef6228..bac94431f0 100644
--- a/src/components/application_manager/src/event_engine/event_dispatcher.cc
+++ b/src/components/application_manager/src/event_engine/event_dispatcher.cc
@@ -39,37 +39,38 @@ namespace event_engine {
using namespace sync_primitives;
EventDispatcher::EventDispatcher()
- : observers_() {
+ : observer_list_lock_(true),
+ observers_() {
}
EventDispatcher::~EventDispatcher() {
}
void EventDispatcher::raise_event(const Event& event) {
- // create local list
- ObserverList list;
{
AutoLock auto_lock(state_lock_);
// check if event is notification
if (hmi_apis::messageType::notification == event.smart_object_type()) {
-
- //ObserversMap iterator
- ObserversMap::iterator it = observers_[event.id()].begin();
- for (; observers_[event.id()].end() != it; ++it) {
- list = it->second;
- }
+ 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()) {
- list = observers_[event.id()][event.smart_object_correlation_id()];
+ observers_list_ = observers_[event.id()][event.smart_object_correlation_id()];
}
}
// Call observers
- ObserverList::iterator observers = list.begin();
- for (; list.end() != observers; ++observers) {
- (*observers)->on_event(event);
+ 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();
}
}
@@ -81,43 +82,57 @@ void EventDispatcher::add_observer(const Event::EventID& event_id,
}
void EventDispatcher::remove_observer(const Event::EventID& event_id,
- EventObserver* const observer) {
+ 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;
- }
- }
+ 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;
- }
+ 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/hmi_capabilities.cc b/src/components/application_manager/src/hmi_capabilities.cc
index 5a3ce71ec6..57b210c828 100644
--- a/src/components/application_manager/src/hmi_capabilities.cc
+++ b/src/components/application_manager/src/hmi_capabilities.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -133,6 +133,11 @@ std::map<std::string, hmi_apis::Common_TextFieldName::eType> text_fields_enum_na
{"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},
};
diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc
index c9d241a9a4..53c82315fc 100644
--- a/src/components/application_manager/src/hmi_command_factory.cc
+++ b/src/components/application_manager/src/hmi_command_factory.cc
@@ -106,8 +106,8 @@
#include "application_manager/commands/hmi/ui_set_global_properties_response.h"
#include "application_manager/commands/hmi/ui_scrollable_message_request.h"
#include "application_manager/commands/hmi/ui_scrollable_message_response.h"
-#include "application_manager/commands/hmi/ui_set_icon_request.h"
-#include "application_manager/commands/hmi/ui_set_icon_response.h"
+#include "application_manager/commands/hmi/ui_set_app_icon_request.h"
+#include "application_manager/commands/hmi/ui_set_app_icon_response.h"
#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h"
#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h"
#include "application_manager/commands/hmi/ui_end_audio_pass_thru_response.h"
@@ -266,7 +266,7 @@ namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
CommandSharedPtr HMICommandFactory::CreateCommand(
- const MessageSharedPtr& message) {
+ const commands::MessageSharedPtr& message) {
const int function_id = (*message)[strings::params][strings::function_id]
.asInt();
LOG4CXX_INFO(logger_,
@@ -455,9 +455,9 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
}
case hmi_apis::FunctionID::UI_SetAppIcon: {
if (is_response) {
- command.reset(new commands::UISetIconResponse(message));
+ command.reset(new commands::UISetAppIconResponse(message));
} else {
- command.reset(new commands::UISetIconRequest(message));
+ command.reset(new commands::UISetAppIconRequest(message));
}
break;
}
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index 832016e874..bb500687dd 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
index 8048b37dda..15e0d5365f 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -259,7 +259,8 @@ uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
void MessageHelper::SendHMIStatusNotification(
const Application& application_impl) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
if (!notification) {
// TODO(VS): please add logger.
return;
@@ -289,9 +290,9 @@ void MessageHelper::SendHMIStatusNotification(
void MessageHelper::SendOnAppRegisteredNotificationToHMI(
const Application& application_impl, bool resumption, bool need_restore_vr) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
if (!notification) {
- // TODO(VS): please add logger.
+ LOG4CXX_ERROR(logger_, "Failed to create smart object");
return;
}
smart_objects::SmartObject& message = *notification;
@@ -352,7 +353,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI(
std::string priority;
policy::PolicyHandler::instance()->GetPriority(
- application_impl.mobile_app_id()->asString(), &priority);
+ application_impl.mobile_app_id(), &priority);
if (!priority.empty()) {
message[strings::msg_params][strings::priority] = GetPriorityCode(priority);
}
@@ -360,64 +361,38 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI(
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(notification));
}
-smart_objects::SmartObject* MessageHelper::GetHashUpdateNotification(
+smart_objects::SmartObjectSPtr MessageHelper::GetHashUpdateNotification(
const uint32_t app_id) {
LOG4CXX_INFO(logger_, "GetHashUpdateNotification" << app_id);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
app_id);
- smart_objects::SmartObject* message = NULL;
- if (NULL == app.get()) {
- return message;
+ if (!app) {
+ return NULL;
}
- message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnHashChangeID;
+ 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();
-
+ static_cast<int32_t>(kNotification);
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_INFO(logger_, "SendHashUpdateNotification");
+ LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject* so = GetHashUpdateNotification(app_id);
+ 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();
}
}
}
@@ -425,11 +400,11 @@ void MessageHelper::SendHashUpdateNotification(const uint32_t app_id) {
void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
int32_t connection_key,
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject;
- if (!notification) {
- // TODO(VS): please add logger.
- return;
- }
+
+ 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] =
@@ -442,7 +417,12 @@ void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
message[strings::msg_params][strings::reason] = static_cast<int32_t>(reason);
- DCHECK(ApplicationManagerImpl::instance()->ManageMobileCommand(notification));
+ if (ApplicationManagerImpl::instance()->ManageMobileCommand(notification)) {
+ LOG4CXX_DEBUG(logger_, "Mobile command sent");
+ }
+ else {
+ LOG4CXX_WARN(logger_, "Cannot send mobile command");
+ }
}
const VehicleData& MessageHelper::vehicle_data() {
@@ -473,6 +453,7 @@ std::string MessageHelper::StringifiedHMILevel(
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(
@@ -521,11 +502,13 @@ static std::map<std::string, uint16_t> vehicle_data_args = create_get_vehicle_da
}
#endif
-void MessageHelper::CreateGetVehicleDataRequest(uint32_t correlation_id, const std::vector<std::string>& params) {
+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::SmartObject* request = new smart_objects::SmartObject;
+ 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;
@@ -538,7 +521,7 @@ void MessageHelper::CreateGetVehicleDataRequest(uint32_t correlation_id, const s
ApplicationManagerImpl::instance()->ManageHMICommand(request);
}
#else
- smart_objects::SmartObject* request = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr request = new smart_objects::SmartObject;
(*request)[strings::params][strings::message_type] = static_cast<int>(kRequest);
(*request)[strings::params][strings::function_id] =
@@ -557,14 +540,12 @@ void MessageHelper::CreateGetVehicleDataRequest(uint32_t correlation_id, const s
#endif
}
-smart_objects::SmartObject* MessageHelper::CreateBlockedByPoliciesResponse(
- mobile_apis::FunctionID::eType function_id,
- mobile_apis::Result::eType result, uint32_t correlation_id,
- uint32_t connection_key) {
- smart_objects::SmartObject* response = new smart_objects::SmartObject;
- if (!response) {
- return NULL;
- }
+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);
@@ -582,14 +563,11 @@ smart_objects::SmartObject* MessageHelper::CreateBlockedByPoliciesResponse(
return response;
}
-smart_objects::SmartObject* MessageHelper::CreateDeviceListSO(
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
const connection_handler::DeviceMap& devices) {
- smart_objects::SmartObject* device_list_so = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- if (NULL == device_list_so) {
- return NULL;
- }
+ 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);
@@ -607,15 +585,16 @@ smart_objects::SmartObject* MessageHelper::CreateDeviceListSO(
policy::PolicyHandler::instance()->GetUserConsentForDevice(it->second.mac_address());
list_so[index][strings::isSDLAllowed] =
policy::DeviceConsent::kDeviceAllowed == device_consent;
+ ++index;
}
- ++index;
return device_list_so;
}
-smart_objects::SmartObject* MessageHelper::CreateModuleInfoSO(
- uint32_t function_id) {
- smart_objects::SmartObject* module_info = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+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);
@@ -626,10 +605,11 @@ smart_objects::SmartObject* MessageHelper::CreateModuleInfoSO(
return module_info;
}
-smart_objects::SmartObject* MessageHelper::CreateSetAppIcon(
+smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
const std::string& path_to_icon, uint32_t app_id) {
- smart_objects::SmartObject* set_icon = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr set_icon = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!set_icon) {
return NULL;
@@ -646,34 +626,40 @@ smart_objects::SmartObject* MessageHelper::CreateSetAppIcon(
}
bool MessageHelper::SendIVISubscribtions(const uint32_t app_id) {
- LOG4CXX_INFO(logger_, " MessageHelper::SendIVISubscribtions ");
+ LOG4CXX_AUTO_TRACE(logger_);
- bool succes = true;
+ bool result = true;
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
app_id);
- DCHECK(app.get());
- SmartObjectList requests = GetIVISubscribtionRequests(app_id);
- for (SmartObjectList::const_iterator it = requests.begin();
+ 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)) {
- succes = false;
+ result = false;
}
}
- return succes;
+ return result;
}
-MessageHelper::SmartObjectList MessageHelper::GetIVISubscribtionRequests(
- const uint32_t app_id) {
- LOG4CXX_INFO(logger_, " MessageHelper::GetIVISubscribtionRequests ");
+smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
+ ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- app_id);
- DCHECK(app);
+ 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_id;
+ 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();
@@ -686,10 +672,9 @@ MessageHelper::SmartObjectList MessageHelper::GetIVISubscribtionRequests(
}
}
- SmartObjectList hmi_requests;
#ifdef HMI_JSON_API
- smart_objects::SmartObject* request = MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
+ 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
@@ -699,7 +684,7 @@ MessageHelper::SmartObjectList MessageHelper::GetIVISubscribtionRequests(
const VehicleInfo_Requests& sr = ivi_subrequests[i];
if (true == msg_params.keyExists(sr.str)
&& true == msg_params[sr.str].asBool()) {
- smart_objects::SmartObject* request = MessageHelper::CreateModuleInfoSO(
+ smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
sr.func_id);
(*request)[strings::msg_params] = msg_params;
hmi_requests.push_back(request);
@@ -709,13 +694,12 @@ MessageHelper::SmartObjectList MessageHelper::GetIVISubscribtionRequests(
return hmi_requests;
}
-void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app) {
- uint32_t id = app->app_id();
-
- utils::SharedPtr<smart_objects::SmartObject> set_app_icon(
- new smart_objects::SmartObject);
+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) {
- smart_objects::SmartObject& so_to_send = *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] =
@@ -729,41 +713,52 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app) {
so_to_send[strings::msg_params] = smart_objects::SmartObject(
smart_objects::SmartType_Map);
- smart_objects::SmartObject* msg_params = MessageHelper::CreateSetAppIcon(
- app->app_icon_path(), id);
+ SmartObjectSPtr msg_params(MessageHelper::CreateSetAppIcon(icon_path, app_id));
if (msg_params) {
so_to_send[strings::msg_params] = *msg_params;
}
- // TODO(PV): appropriate handling of result
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(set_app_icon));
+ ApplicationManagerImpl::instance()->ManageHMICommand(set_app_icon);
}
+}
- SendGlobalPropertiesToHMI(app);
- SendShowRequestToHMI(app);
+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) {
- DCHECK(app.get());
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return;
+ }
- SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(app);
- for (SmartObjectList::const_iterator it = requests.begin();
+ smart_objects::SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(app);
+ for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
it != requests.end(); ++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it))
}
}
-MessageHelper::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI(
ApplicationConstSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
- SmartObjectList requests;
- DCHECK(app.get());
+ 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::SmartObject* ui_global_properties =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr ui_global_properties =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!ui_global_properties) {
return requests;
@@ -806,8 +801,8 @@ MessageHelper::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
// TTS global properties
if (app->help_prompt() || app->timeout_prompt()) {
- smart_objects::SmartObject* tts_global_properties =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr tts_global_properties =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!tts_global_properties) {
return requests;
@@ -843,10 +838,11 @@ MessageHelper::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
void MessageHelper::SendTTSGlobalProperties(
ApplicationSharedPtr app, bool default_help_prompt) {
- if (!app.valid()) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
return;
}
- utils::SharedPtr<smart_objects::SmartObject> tts_global_properties(
+ smart_objects::SmartObjectSPtr tts_global_properties(
new smart_objects::SmartObject);
if (tts_global_properties) {
smart_objects::SmartObject& so_to_send = *tts_global_properties;
@@ -865,7 +861,8 @@ void MessageHelper::SendTTSGlobalProperties(
msg_params[strings::help_prompt] = smart_objects::SmartObject(
smart_objects::SmartType_Array);
if (default_help_prompt) {
- const CommandsMap& commands = app->commands_map();
+ 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) {
@@ -886,10 +883,10 @@ void MessageHelper::SendTTSGlobalProperties(
}
}
-smart_objects::SmartObject* MessageHelper::CreateAppVrHelp(
+smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
ApplicationConstSharedPtr app) {
- smart_objects::SmartObject* result = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!result) {
return NULL;
}
@@ -897,11 +894,11 @@ smart_objects::SmartObject* MessageHelper::CreateAppVrHelp(
vr_help[strings::vr_help_title] = app->name();
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> apps = accessor.applications();
int32_t index = 0;
- std::set<ApplicationSharedPtr>::const_iterator it_app = apps.begin();
- for (; apps.end() != it_app; ++it_app) {
+ ApplicationManagerImpl::ApplictionSetConstIt it_app =
+ accessor.begin();
+ for (; accessor.end() != it_app; ++it_app) {
if ((*it_app)->vr_synonyms()) {
smart_objects::SmartObject item(smart_objects::SmartType_Map);
item[strings::text] = (*((*it_app)->vr_synonyms())).getElement(0);
@@ -911,7 +908,8 @@ smart_objects::SmartObject* MessageHelper::CreateAppVrHelp(
}
// copy all app VR commands
- const CommandsMap& commands = app->commands_map();
+ 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) {
@@ -923,14 +921,18 @@ smart_objects::SmartObject* MessageHelper::CreateAppVrHelp(
return result;
}
-MessageHelper::SmartObjectList MessageHelper::CreateShowRequestToHMI(
- ApplicationConstSharedPtr app) {
- DCHECK(app.get());
+smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
+ ApplicationConstSharedPtr app) {
+
+ smart_objects::SmartObjectList requests;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return requests;
+ }
- SmartObjectList requests;
- smart_objects::SmartObject* ui_show = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
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] =
@@ -951,10 +953,10 @@ void MessageHelper::SendShowRequestToHMI(ApplicationConstSharedPtr app) {
if (!app) {
return;
}
- SmartObjectList shows = CreateShowRequestToHMI(app);
+ smart_objects::SmartObjectList shows = CreateShowRequestToHMI(app);
- for (SmartObjectList::const_iterator it = shows.begin(); it != shows.end();
- ++it) {
+ for (smart_objects::SmartObjectList::const_iterator it = shows.begin();
+ it != shows.end(); ++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
@@ -966,14 +968,12 @@ void MessageHelper::SendShowConstantTBTRequestToHMI(
return;
}
- smart_objects::SmartObject* navi_show_tbt = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- if (!navi_show_tbt) {
- 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] =
@@ -993,25 +993,30 @@ void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app) {
if (!app) {
return;
}
- SmartObjectList requests = CreateAddCommandRequestToHMI(app);
- for (SmartObjectList::iterator it = requests.begin(); it != requests.end();
+ smart_objects::SmartObjectList requests = CreateAddCommandRequestToHMI(app);
+ for (smart_objects::SmartObjectList::iterator it = requests.begin(); it != requests.end();
++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
}
-MessageHelper::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
+smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app) {
- DCHECK(app.get());
- SmartObjectList requests;
- const CommandsMap& commands = app->commands_map();
+ 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::SmartObject* ui_command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr ui_command = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!ui_command) {
return requests;
@@ -1053,10 +1058,11 @@ MessageHelper::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
return requests;
}
-smart_objects::SmartObject* MessageHelper::CreateChangeRegistration(
- int32_t function_id, int32_t language, uint32_t app_id) {
- smart_objects::SmartObject* command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+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;
}
@@ -1079,16 +1085,37 @@ smart_objects::SmartObject* MessageHelper::CreateChangeRegistration(
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::SmartObject* vr_command = CreateChangeRegistration(
+ smart_objects::SmartObjectSPtr vr_command = CreateChangeRegistration(
hmi_apis::FunctionID::VR_ChangeRegistration, app->language(),
app->app_id());
@@ -1098,7 +1125,7 @@ void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr
}
if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObject* tts_command = CreateChangeRegistration(
+ smart_objects::SmartObjectSPtr tts_command = CreateChangeRegistration(
hmi_apis::FunctionID::TTS_ChangeRegistration, app->language(),
app->app_id());
@@ -1108,7 +1135,7 @@ void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr
}
if (mobile_apis::Language::INVALID_ENUM != app->ui_language()) {
- smart_objects::SmartObject* ui_command = CreateChangeRegistration(
+ smart_objects::SmartObjectSPtr ui_command = CreateChangeRegistration(
hmi_apis::FunctionID::UI_ChangeRegistration, app->ui_language(),
app->app_id());
@@ -1122,18 +1149,17 @@ void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr
void MessageHelper::SendAddVRCommandToHMI(
uint32_t cmd_id, const smart_objects::SmartObject& vr_commands,
uint32_t app_id) {
- smart_objects::SmartObject* request = CreateAddVRCommandToHMI(cmd_id,
+ smart_objects::SmartObjectSPtr request = CreateAddVRCommandToHMI(cmd_id,
vr_commands,
app_id);
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(request));
}
-smart_objects::SmartObject* MessageHelper::CreateAddVRCommandToHMI(
- uint32_t cmd_id,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& vr_commands,
- uint32_t app_id) {
- smart_objects::SmartObject* vr_command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+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;
@@ -1170,8 +1196,8 @@ smart_objects::SmartObject* MessageHelper::CreateAddVRCommandToHMI(
bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
smart_objects::SmartObject& output) {
-
- if (false == app.valid()) {
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Application is not valid");
return false;
}
@@ -1184,36 +1210,41 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
output[strings::app_name] = app->name();
output[strings::icon] = app->app_icon_path();
output[strings::device_name] = device_name;
- output[strings::app_id] = app->app_id();
+ output[strings::app_id] = app->hmi_app_id();
output[strings::hmi_display_language_desired] = app->ui_language();
output[strings::is_media_application] = app->is_media_application();
- if (NULL != ngn_media_screen_name) {
+ if (ngn_media_screen_name) {
output[strings::ngn_media_screen_app_name] = ngn_media_screen_name->asString();
}
- if (NULL != app_types) {
+ if (app_types) {
output[strings::app_type] = *app_types;
}
return true;
}
void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app) {
- DCHECK(app.get());
- SmartObjectList requests = CreateAddSubMenuRequestToHMI(app);
- for (SmartObjectList::iterator it = requests.begin(); it != requests.end();
- ++it) {
+ 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));
}
}
-MessageHelper::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
ApplicationConstSharedPtr app) {
- SmartObjectList requsets;
- const SubMenuMap& sub_menu = app->sub_menu_map();
+ 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::SmartObject* ui_sub_menu = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr ui_sub_menu = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!ui_sub_menu) {
return requsets;
@@ -1247,8 +1278,8 @@ MessageHelper::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
void MessageHelper::SendOnAppUnregNotificationToHMI(
ApplicationConstSharedPtr app, bool is_unexpected_disconnect) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!notification) {
return;
}
@@ -1264,22 +1295,23 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
message[strings::msg_params][strings::app_id] = app->hmi_app_id();
message[strings::msg_params][strings::unexpected_disconnect] =
is_unexpected_disconnect;
- ApplicationManagerImpl::instance()->ManageHMICommand(&message);
+ ApplicationManagerImpl::instance()->ManageHMICommand(notification);
}
void MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
- hmi_apis::Common_HMILevel::eType level) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority) {
application_manager::ApplicationConstSharedPtr app =
application_manager::ApplicationManagerImpl::instance()
->application(app_id);
- if (!app.valid()) {
+ 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_ActivateApp;
(*message)[strings::params][strings::message_type] = MessageType::kRequest;
@@ -1287,23 +1319,25 @@ void MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
(*message)[strings::msg_params][strings::app_id] = app_id;
- std::string priority;
- // TODO(KKolodiy): need remove method policy_manager
-
- policy::PolicyHandler::instance()->GetPriority(
- app->mobile_app_id()->asString(), &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]["priority"] = GetPriorityCode(priority);
+ 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.
@@ -1317,17 +1351,17 @@ void MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id) {
LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
-
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
application_manager::ApplicationConstSharedPtr app =
application_manager::ApplicationManagerImpl::instance()
->application(app_id);
- if (!app.valid()) {
+ 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;
@@ -1344,7 +1378,7 @@ std::string MessageHelper::GetDeviceMacAddressForHandle(
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;
}
@@ -1372,8 +1406,8 @@ void MessageHelper::GetDeviceInfoForApp(uint32_t connection_key,
void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissions,
uint32_t correlation_id) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -1418,21 +1452,12 @@ void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissio
if (permissions.appRevoked || !permissions.isSDLAllowed) {
return;
}
-
- // Send HMI status notification to mobile
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()
- ->application_by_policy_id(permissions.application_id);
- if (app) {
- ApplicationManagerImpl::instance()->ActivateApplication(app);
- } else {
- LOG4CXX_WARN(logger_, "Unable to find app_id: " << permissions.application_id);
- }
}
void MessageHelper::SendOnSDLConsentNeeded(
const policy::DeviceParams& device_info) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -1452,8 +1477,8 @@ void MessageHelper::SendPolicyUpdate(
const std::string& file_path,
int timeout,
const std::vector<int>& retries) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ 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;
@@ -1478,8 +1503,8 @@ void MessageHelper::SendPolicyUpdate(
void MessageHelper::SendGetUserFriendlyMessageResponse(
const std::vector<policy::UserFriendlyMessage>& msg,
uint32_t correlation_id) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -1543,8 +1568,8 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
void MessageHelper::SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
uint32_t correlation_id) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -1584,11 +1609,11 @@ void MessageHelper::SendGetListOfPermissionsResponse(
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
-smart_objects::SmartObject* MessageHelper::CreateNegativeResponse(
- uint32_t connection_key, int32_t function_id, uint32_t correlation_id,
- int32_t result_code) {
- smart_objects::SmartObject* response = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+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] =
@@ -1606,9 +1631,9 @@ smart_objects::SmartObject* MessageHelper::CreateNegativeResponse(
}
void MessageHelper::SendNaviStartStream(int32_t connection_key) {
- LOG4CXX_INFO(logger_, "MessageHelper::SendNaviStartStream");
- smart_objects::SmartObject* start_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr start_stream = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!start_stream) {
return;
@@ -1655,8 +1680,8 @@ void MessageHelper::SendNaviStartStream(int32_t connection_key) {
}
void MessageHelper::SendNaviStopStream(int32_t connection_key) {
- smart_objects::SmartObject* stop_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr stop_stream = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!stop_stream) {
return;
@@ -1689,8 +1714,8 @@ void MessageHelper::SendNaviStopStream(int32_t connection_key) {
void MessageHelper::SendAudioStartStream(int32_t connection_key) {
- smart_objects::SmartObject* start_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr start_stream = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!start_stream) {
return;
@@ -1738,8 +1763,8 @@ void MessageHelper::SendAudioStartStream(int32_t connection_key) {
}
void MessageHelper::SendAudioStopStream(int32_t connection_key) {
- smart_objects::SmartObject* stop_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr stop_stream = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!stop_stream) {
return;
@@ -1773,11 +1798,10 @@ void MessageHelper::SendAudioStopStream(int32_t connection_key) {
bool MessageHelper::SendStopAudioPathThru() {
LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru");
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
const uint32_t hmi_correlation_id = ApplicationManagerImpl::instance()
->GetNextHMICorrelationID();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
+ smart_objects::SmartObject& request = *result;
request[strings::params][strings::message_type] = MessageType::kRequest;
request[strings::params][strings::function_id] =
hmi_apis::FunctionID::UI_EndAudioPassThru;
@@ -1792,40 +1816,80 @@ bool MessageHelper::SendStopAudioPathThru() {
void MessageHelper::SendPolicySnapshotNotification(
unsigned int connection_key, const std::vector<uint8_t>& policy_data,
const std::string& url, int timeout) {
- smart_objects::SmartObject* pt_notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- smart_objects::SmartObject& content = *pt_notification;
- ;
- 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;
+
+ using namespace mobile_apis;
+ using namespace smart_objects;
+
+ SmartObject content (SmartType_Map);
if (!url.empty()) {
content[strings::msg_params][mobile_notification::syncp_url] = url;
}
- content[strings::msg_params][strings::file_type] =
- mobile_apis::FileType::BINARY;
- content[strings::msg_params][strings::request_type] =
- mobile_apis::RequestType::HTTP;
- /*if (-1 != timeout) {
- content[strings::msg_params][mobile_notification::syncp_timeout] = timeout;
- }*/
- content[strings::params][strings::binary_data] = smart_objects::SmartObject(
- policy_data);
- ApplicationManagerImpl::instance()->ManageMobileCommand(pt_notification);
+
+ 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::urlSchema] = urlSchema;
+ } else if (!packageName.empty()) {
+ content[strings::msg_params][strings::packageName] = 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();
+
+ SendSystemRequestNotification(connection_key, content);
}
void MessageHelper::SendOnPermissionsChangeNotification(
uint32_t connection_key, const policy::Permissions& permissions) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject(
+ 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] =
@@ -1836,7 +1900,7 @@ void MessageHelper::SendOnPermissionsChangeNotification(
commands::CommandImpl::protocol_version_;
content[strings::params][strings::connection_key] = connection_key;
- smart_objects::SmartObject* p_msg_params = new smart_objects::SmartObject(
+ utils::SharedPtr<smart_objects::SmartObject> p_msg_params = new smart_objects::SmartObject(
smart_objects::SmartType_Map);
smart_objects::SmartObject& msg_params = *p_msg_params;
@@ -1964,8 +2028,8 @@ void MessageHelper::FillAppRevokedPermissions(
void MessageHelper::SendOnAppPermissionsChangedNotification(
uint32_t connection_key, const policy::AppPermissions& permissions) {
- smart_objects::SmartObject* notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!notification) {
return;
}
@@ -2002,13 +2066,13 @@ void MessageHelper::SendOnAppPermissionsChangedNotification(
permissions.priority);
}
- ApplicationManagerImpl::instance()->ManageHMICommand(&message);
+ ApplicationManagerImpl::instance()->ManageHMICommand(notification);
}
void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
uint32_t correlation_id) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -2025,9 +2089,10 @@ void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
-void MessageHelper::SendUpdateSDLResponse(const std::string& result, uint32_t correlation_id) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+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;
}
@@ -2044,11 +2109,9 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, uint32_t co
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
-
-
void MessageHelper::SendOnStatusUpdate(const std::string& status) {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -2064,8 +2127,8 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status) {
}
void MessageHelper::SendGetSystemInfoRequest() {
- smart_objects::SmartObject* message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -2090,6 +2153,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
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;
}
}
@@ -2100,6 +2164,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
app);
if (mobile_apis::Result::SUCCESS != verification_result) {
+ LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << verification_result);
return verification_result; // exit point
}
} else {
@@ -2110,6 +2175,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
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;
}
}
@@ -2139,12 +2205,25 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
return mobile_apis::Result::INVALID_DATA;
}
- std::string full_file_path =
- profile::Profile::instance()->app_storage_folder() + "/";
-
+ 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 += "/";
@@ -2188,15 +2267,31 @@ bool MessageHelper::VerifySoftButtonString(const std::string& str) {
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 smart_objects::SmartObject* soft_button_capabilities = hmi_capabilities
+ const SmartObject* soft_button_capabilities = hmi_capabilities
.soft_button_capabilities();
bool image_supported = false;
if (soft_button_capabilities) {
@@ -2204,31 +2299,27 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
.asBool();
}
- smart_objects::SmartObject& request_soft_buttons =
- message_params[strings::soft_buttons];
+ SmartObject& request_soft_buttons = message_params[strings::soft_buttons];
// Check whether soft buttons request is well-formed
if (!ValidateSoftButtons(request_soft_buttons)) {
- return mobile_apis::Result::INVALID_DATA;
+ return Result::INVALID_DATA;
}
- smart_objects::SmartObject soft_buttons = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
-
- policy::PolicyHandler* policy_handler = policy::PolicyHandler::instance();
- std::string app_mobile_id = app->mobile_app_id()->asString();
+ SmartObject soft_buttons(SmartType_Array);
uint32_t j = 0;
size_t size = request_soft_buttons.length();
for (uint32_t i = 0; i < size; ++i) {
- int system_action = request_soft_buttons[i][strings::system_action].asInt();
- if (!policy_handler->CheckKeepContext(system_action, app_mobile_id) ||
- !policy_handler->CheckStealFocus(system_action, app_mobile_id)) {
- return mobile_apis::Result::DISALLOWED;
+ 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 mobile_apis::SoftButtonType::SBT_IMAGE: {
+ case SoftButtonType::SBT_IMAGE: {
if (!image_supported) {
continue;
}
@@ -2237,46 +2328,46 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
request_soft_buttons[i].erase(strings::text);
}
if (request_soft_buttons[i].keyExists(strings::image)) {
- mobile_apis::Result::eType verification_result = VerifyImage(
+ Result::eType verification_result = VerifyImage(
request_soft_buttons[i][strings::image], app);
- if (mobile_apis::Result::SUCCESS != verification_result) {
- return mobile_apis::Result::INVALID_DATA;
+ if (Result::SUCCESS != verification_result) {
+ return Result::INVALID_DATA;
}
} else {
- return mobile_apis::Result::INVALID_DATA;
+ return Result::INVALID_DATA;
}
break;
}
- case mobile_apis::SoftButtonType::SBT_TEXT: {
+ case SoftButtonType::SBT_TEXT: {
if ((!request_soft_buttons[i].keyExists(strings::text)) ||
(!VerifySoftButtonString(
request_soft_buttons[i][strings::text].asString()))) {
- return mobile_apis::Result::INVALID_DATA;
+ return Result::INVALID_DATA;
}
break;
}
- case mobile_apis::SoftButtonType::SBT_BOTH: {
+ 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 mobile_apis::Result::INVALID_DATA;
+ return Result::INVALID_DATA;
}
bool image_exist = false;
if (image_supported) {
image_exist = request_soft_buttons[i].keyExists(strings::image);
if (!image_exist) {
- return mobile_apis::Result::INVALID_DATA;
+ return Result::INVALID_DATA;
}
}
if (image_exist) {
- mobile_apis::Result::eType verification_result = VerifyImage(
+ Result::eType verification_result = VerifyImage(
request_soft_buttons[i][strings::image], app);
- if (mobile_apis::Result::SUCCESS != verification_result) {
- return mobile_apis::Result::INVALID_DATA;
+ if (Result::SUCCESS != verification_result) {
+ return Result::INVALID_DATA;
}
}
@@ -2297,7 +2388,7 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
if (0 == request_soft_buttons.length()) {
message_params.erase(strings::soft_buttons);
}
- return mobile_apis::Result::SUCCESS;
+ return Result::SUCCESS;
}
void MessageHelper::SubscribeApplicationToSoftButton(
diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc
index 2d2e31f735..0d592e9562 100644
--- a/src/components/application_manager/src/mobile_command_factory.cc
+++ b/src/components/application_manager/src/mobile_command_factory.cc
@@ -67,6 +67,7 @@
#include "application_manager/commands/mobile/on_button_press_notification.h"
#include "application_manager/commands/mobile/on_driver_distraction_notification.h"
#include "application_manager/commands/mobile/on_hmi_status_notification.h"
+#include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h"
#include "application_manager/commands/mobile/on_language_change_notification.h"
#include "application_manager/commands/mobile/on_command_notification.h"
#include "application_manager/commands/mobile/on_permissions_change_notification.h"
@@ -91,8 +92,8 @@
#include "application_manager/commands/mobile/set_display_layout_response.h"
#include "application_manager/commands/mobile/set_global_properties_request.h"
#include "application_manager/commands/mobile/set_global_properties_response.h"
-#include "application_manager/commands/mobile/set_icon_request.h"
-#include "application_manager/commands/mobile/set_icon_response.h"
+#include "application_manager/commands/mobile/set_app_icon_request.h"
+#include "application_manager/commands/mobile/set_app_icon_response.h"
#include "application_manager/commands/mobile/set_media_clock_timer_request.h"
#include "application_manager/commands/mobile/set_media_clock_timer_response.h"
#include "application_manager/commands/mobile/show_constant_tbt_request.h"
@@ -129,7 +130,8 @@
namespace application_manager {
commands::Command *MobileCommandFactory::CreateCommand(
- const MessageSharedPtr& message) {
+ const commands::MessageSharedPtr& message,
+ commands::Command::CommandOrigin origin) {
switch ((*message)[strings::params][strings::function_id].asInt()) {
case mobile_apis::FunctionID::RegisterAppInterfaceID: {
@@ -398,9 +400,9 @@ commands::Command *MobileCommandFactory::CreateCommand(
case mobile_apis::FunctionID::SetAppIconID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SetIconResponse(message);
+ return new commands::SetAppIconResponse(message);
} else {
- return new commands::SetIconRequest(message);
+ return new commands::SetAppIconRequest(message);
}
break;
}
@@ -519,6 +521,9 @@ commands::Command *MobileCommandFactory::CreateCommand(
break;
}
case mobile_apis::FunctionID::OnHMIStatusID: {
+ if (origin == commands::Command::ORIGIN_MOBILE) {
+ return new commands::OnHMIStatusNotificationFromMobile(message);
+ }
return new commands::OnHMIStatusNotification(message);
break;
}
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index 22260e214e..a1c8385549 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -50,9 +50,36 @@ const uint8_t kUnknown = 0xF;
}
namespace application_manager {
+using protocol_handler::Extract;
CREATE_LOGGERPTR_GLOBAL(logger_, "MobileMessageHandler")
+application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocol(
+ const protocol_handler::RawMessagePtr message) {
+ if (message->protocol_version() == ProtocolVersion::kV1) {
+ return MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
+ }
+ if ((message->protocol_version() == ProtocolVersion::kV2) ||
+ (message->protocol_version() == ProtocolVersion::kV3) ||
+ (message->protocol_version() == ProtocolVersion::kV4)) {
+ return MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ }
+ return NULL;
+}
+
+protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocol(
+ const MobileMessage& 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)) {
+ return MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
+ }
+ return NULL;
+}
+
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV1(
@@ -78,6 +105,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
message->data_size()));
if (outgoing_message->json_message().empty()) {
+ delete outgoing_message;
return NULL;
}
@@ -112,7 +140,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
outgoing_message->set_function_id(payload.header.rpc_function_id);
outgoing_message->set_message_type(
MessageTypeFromRpcType(payload.header.rpc_type));
- outgoing_message->set_correlation_id(int32_t(payload.header.corellation_id));
+ 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
@@ -145,6 +173,8 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1(
protocol_handler::RawMessage* result = new protocol_handler::RawMessage(
message->connection_key(), 1, rawMessage, messageString.length() + 1);
+ delete [] rawMessage;
+
return result;
}
@@ -216,6 +246,8 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2(
dataForSending,
dataForSendingSize);
+ delete [] dataForSending;
+
return msgToProtocolHandler;
}
} // namespace application_manager
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index 488097761a..09f97dd3f1 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -32,20 +32,31 @@
#include "application_manager/policies/policy_event_observer.h"
#include "application_manager/smart_object_keys.h"
+#include "application_manager/policies/policy_handler.h"
#include "utils/date_time.h"
-#include "policy/policy_manager.h"
#include "smart_objects/smart_object.h"
namespace policy {
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
using namespace application_manager;
+class PolicyHandler;
-PolicyEventObserver::PolicyEventObserver(utils::SharedPtr<PolicyManager> policy_manager)
- : policy_manager_(policy_manager) {
+CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+
+PolicyEventObserver::PolicyEventObserver(PolicyHandler* const policy_handler)
+ : policy_handler_(policy_handler) {
+}
+
+void PolicyEventObserver::set_policy_handler(policy::PolicyHandler* const policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(policy_handler_lock_);
+ LOG4CXX_DEBUG(logger_, "Set policy handler " << policy_handler);
+ policy_handler_ = policy_handler;
}
void PolicyEventObserver::on_event(const event_engine::Event& event) {
- if (!policy_manager_) {
+ sync_primitives::AutoLock auto_lock(policy_handler_lock_);
+ if (!policy_handler_) {
return;
}
const smart_objects::SmartObject& message = event.smart_object();
@@ -67,7 +78,7 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- policy_manager_->OnSystemReady();
+ policy_handler_->OnSystemReady();
unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
break;
}
@@ -88,8 +99,8 @@ void PolicyEventObserver::ProcessOdometerEvent(const smart_objects::SmartObject&
const int kSecondsInDay = 60 * 60 * 24;
int days_after_epoch = current_time.tv_sec / kSecondsInDay;
- if(policy_manager_) {
- policy_manager_->PTUpdatedAt(
+ if (policy_handler_) {
+ policy_handler_->PTUpdatedAt(
message[strings::msg_params][strings::odometer].asInt(),
days_after_epoch);
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 8e73b4bdf4..457534302d 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1,5 +1,5 @@
-/*
- Copyright (c) 2013, Ford Motor Company
+/*
+ Copyright (c) 2014, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,9 +35,11 @@
#include <algorithm>
#include <vector>
#include "application_manager/smart_object_keys.h"
+
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/policies/pt_exchange_handler_impl.h"
-#include "application_manager/policies/pt_exchange_handler_ext.h"
+
+#include "application_manager/policies/delegates/app_permission_delegate.h"
+
#include "application_manager/application_manager_impl.h"
#include "application_manager/message_helper.h"
#include "policy/policy_manager_impl.h"
@@ -54,34 +56,61 @@
namespace policy {
+using namespace application_manager;
+
#define POLICY_LIB_CHECK(return_value) {\
+ sync_primitives::AutoReadLock lock(policy_manager_lock_); \
if (!policy_manager_) {\
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");\
+ 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_WARN(logger_, "The shared library of policy is not loaded");\
+ LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded");\
return;\
}\
}
CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
-typedef std::set<application_manager::ApplicationSharedPtr> ApplicationList;
+
+struct ApplicationListHmiLevelSorter {
+ 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();
+
+ if (lhs_hmi_level == rhs_hmi_level) {
+ return lhs->app_id() < rhs->app_id();
+ }
+ return lhs_hmi_level < rhs_hmi_level;
+ }
+ return false;
+ }
+};
+
+typedef std::set<application_manager::ApplicationSharedPtr, ApplicationListHmiLevelSorter>
+HmiLevelOrderedApplicationList;
struct DeactivateApplication {
explicit DeactivateApplication(
const connection_handler::DeviceHandle& device_id)
: device_id_(device_id) {}
- void operator()(const application_manager::ApplicationSharedPtr& app) {
+ void operator()(const ApplicationSharedPtr& app) {
if (device_id_ == app->device()) {
- app->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
- application_manager::MessageHelper::SendActivateAppToHMI(
- app->app_id(), hmi_apis::Common_HMILevel::NONE);
+ if (mobile_api::HMILevel::HMI_NONE != app->hmi_level()) {
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ mobile_apis::HMILevel::HMI_NONE);
+ app->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE);
+ MessageHelper::SendActivateAppToHMI(
+ app->app_id(), hmi_apis::Common_HMILevel::NONE);
+ MessageHelper::SendHMIStatusNotification(*app.get());
+ }
}
}
@@ -90,13 +119,12 @@ struct DeactivateApplication {
};
struct SDLAlowedNotification {
- explicit SDLAlowedNotification(
- const connection_handler::DeviceHandle& device_id,
- utils::SharedPtr<PolicyManager> policy_manager)
+ SDLAlowedNotification(const connection_handler::DeviceHandle& device_id,
+ PolicyManager* policy_manager)
: device_id_(device_id),
policy_manager_(policy_manager){}
- void operator()(const application_manager::ApplicationSharedPtr& app) {
+ void operator()(const ApplicationSharedPtr& app) {
if (!policy_manager_) {
return;
}
@@ -104,7 +132,7 @@ struct SDLAlowedNotification {
std::string hmi_level;
hmi_apis::Common_HMILevel::eType default_hmi;
mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->mobile_app_id()->asString(), &hmi_level);
+ policy_manager_->GetDefaultHmi(app->mobile_app_id(), &hmi_level);
if ("BACKGROUND" == hmi_level) {
default_hmi = hmi_apis::Common_HMILevel::BACKGROUND;
default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
@@ -121,17 +149,18 @@ struct SDLAlowedNotification {
return ;
}
if (app->hmi_level() == default_mobile_hmi) {
- LOG4CXX_INFO(logger_, "Application already in default hmi state.");
+ LOG4CXX_DEBUG(logger_, "Application already in default hmi state.");
} else {
- app->set_hmi_level(default_mobile_hmi);
- application_manager::MessageHelper::SendHMIStatusNotification(*app);
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ default_mobile_hmi);
+ MessageHelper::SendHMIStatusNotification(*app);
}
- application_manager::MessageHelper::SendActivateAppToHMI(app->app_id(), default_hmi);
+ MessageHelper::SendActivateAppToHMI(app->app_id(), default_hmi);
}
}
private:
connection_handler::DeviceHandle device_id_;
- utils::SharedPtr<PolicyManager> policy_manager_;
+ PolicyManager* policy_manager_;
};
struct LinkAppToDevice {
@@ -141,17 +170,17 @@ struct LinkAppToDevice {
app_to_device_link_.clear();
}
- void operator()(const application_manager::ApplicationSharedPtr& app) {
+ void operator()(const ApplicationSharedPtr& app) {
if (!app.valid()) {
LOG4CXX_WARN(logger_, "Invalid pointer to application was passed."
"Skip current application.");
return;
}
DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForApp(
+ MessageHelper::GetDeviceInfoForApp(
app->app_id(),
&device_params);
- const std::string app_id = app->mobile_app_id()->asString();
+ const std::string app_id = app->mobile_app_id();
if (device_params.device_mac_address.empty()) {
LOG4CXX_WARN(logger_, "Couldn't find device, which hosts application "
<< app_id);
@@ -208,13 +237,10 @@ const std::string PolicyHandler::kLibrary = "libPolicy.so";
PolicyHandler::PolicyHandler()
- : dl_handle_(0),
-// EXTENDED_POLICY
- exchange_handler_(new PTExchangeHandlerImpl(this)),
- on_ignition_check_done_(false),
+ : AsyncRunner("PolicyHandler async runner thread"),
+ dl_handle_(0),
last_activated_app_id_(0),
- registration_in_progress(false),
- is_user_requested_policy_table_update_(false),
+ app_to_device_link_lock_(true),
statistic_manager_impl_(new StatisticManagerImpl()) {
}
@@ -223,6 +249,8 @@ PolicyHandler::~PolicyHandler() {
}
bool PolicyHandler::LoadPolicyLibrary() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoWriteLock lock(policy_manager_lock_);
if (!PolicyEnabled()) {
LOG4CXX_WARN(logger_, "System is configured to work without policy "
"functionality.");
@@ -235,7 +263,7 @@ bool PolicyHandler::LoadPolicyLibrary() {
if (error_string == NULL) {
if (CreateManager()) {
policy_manager_->set_listener(this);
- event_observer_= new PolicyEventObserver(policy_manager_);
+ event_observer_= new PolicyEventObserver(this);
}
} else {
LOG4CXX_ERROR(logger_, error_string);
@@ -257,22 +285,22 @@ bool PolicyHandler::CreateManager() {
} else {
LOG4CXX_WARN(logger_, error_string);
}
- return policy_manager_;
+ return policy_manager_.valid();
}
bool PolicyHandler::InitPolicyTable() {
- LOG4CXX_TRACE(logger_, "Init policy table from preloaded.");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
// Subscribing to notification for system readiness to be able to get system
// info necessary for policy table
- event_observer_.get()->subscribe_on_event(
+ event_observer_->subscribe_on_event(
hmi_apis::FunctionID::BasicCommunication_OnReady);
std::string preloaded_file =
profile::Profile::instance()->preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->InitPT(preloaded_file);
}
- LOG4CXX_WARN(logger_, "The file which contains preloaded PT is not exist");
+ LOG4CXX_FATAL(logger_, "The file which contains preloaded PT is not exist");
return false;
}
@@ -289,148 +317,60 @@ bool PolicyHandler::ResetPolicyTable() {
}
bool PolicyHandler::ClearUserConsent() {
- LOG4CXX_INFO(logger_, "Removing user consent records in policy table.");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
return policy_manager_->ResetUserConsent();
}
uint32_t PolicyHandler::GetAppIdForSending() {
- // Get app.list
- application_manager::ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationList app_list = accessor.applications();
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ HmiLevelOrderedApplicationList app_list(accessor.begin(), accessor.end());
- if (app_list.empty()) {
- return 0;
- }
-
- // Choose application
- uint32_t selected_app_id = 0;
- AppIds app_ids_last_resort;
- AppIds app_ids_preferred;
+ LOG4CXX_INFO(logger_, "Apps size: " << app_list.size());
- ApplicationList::const_iterator it_app_list = app_list.begin();
- ApplicationList::const_iterator it_app_list_end = app_list.end();
- for (; it_app_list != it_app_list_end; ++it_app_list) {
- switch ((*it_app_list)->hmi_level()) {
- case mobile_apis::HMILevel::HMI_NONE:
- app_ids_last_resort.push_back((*it_app_list)->app_id());
- break;
- default:
- app_ids_preferred.push_back((*it_app_list)->app_id());
- break;
+ DeviceParams device_param;
+ for (HmiLevelOrderedApplicationList::const_iterator first = app_list.begin();
+ first != app_list.end(); ++first) {
+ if ((*first)->IsRegistered()) {
+ const uint32_t app_id = (*first)->app_id();
+ MessageHelper::GetDeviceInfoForApp(app_id, &device_param);
+ if (kDeviceAllowed ==
+ policy_manager_->GetUserConsentForDevice(device_param.device_mac_address)) {
+ return app_id;
+ }
}
}
- AppIds& app_ids_to_use =
- app_ids_preferred.empty() ? app_ids_last_resort : app_ids_preferred;
-
- // Checking, if some of currently known apps was not used already
- std::sort(last_used_app_ids_.begin(), last_used_app_ids_.end());
- std::sort(app_ids_to_use.begin(), app_ids_to_use.end());
-
- bool is_all_used = std::includes(last_used_app_ids_.begin(),
- last_used_app_ids_.end(),
- app_ids_to_use.begin(),
- app_ids_to_use.end());
-
- if (is_all_used) {
- last_used_app_ids_.clear();
- }
-
- // Leave only unused apps
- AppIds::iterator it_apps_to_use = app_ids_to_use.begin();
- AppIds::iterator it_apps_to_use_end = app_ids_to_use.end();
-
- AppIds::const_iterator it_last_used_app_ids = last_used_app_ids_.begin();
- AppIds::const_iterator it_last_used_app_ids_end = last_used_app_ids_.end();
-
- for (; it_last_used_app_ids != it_last_used_app_ids_end;
- ++it_last_used_app_ids) {
-
- std::remove(it_apps_to_use, it_apps_to_use_end, *it_last_used_app_ids);
- }
-
- // Random selection of filtered apps
- std::srand(time(0));
- selected_app_id =
- *(app_ids_to_use.begin() + (rand() % app_ids_to_use.size()));
-
- last_used_app_ids_.push_back(selected_app_id);
- return selected_app_id;
-}
-
-DeviceConsent PolicyHandler::GetDeviceForSending(DeviceParams& device_params) {
- POLICY_LIB_CHECK(kDeviceDisallowed);
- uint32_t app_id = 0;
- uint32_t app_id_previous = 0;
- while (true) {
- app_id = GetAppIdForSending();
- if (!app_id) {
- LOG4CXX_WARN(logger_,
- "There is no appropriate application for sending PTS.");
- return kDeviceDisallowed;
- }
-
- // If only one application is available, return its device params
- if (app_id == app_id_previous) {
- return kDeviceDisallowed;
- }
-
- app_id_previous = app_id;
- application_manager::MessageHelper::GetDeviceInfoForApp(app_id,
- &device_params);
-
- DeviceConsent consent = policy_manager_->GetUserConsentForDevice(
- device_params.device_mac_address);
- switch (consent) {
- case kDeviceAllowed:
- return consent;
- case kDeviceDisallowed:
- continue;
- case kDeviceHasNoConsent:
- return consent;
- default:
- LOG4CXX_WARN(logger_, "Consent result is not impelemented.");
- return consent;
- }
- }
- return kDeviceDisallowed;
+ return 0;
}
-const std::string PolicyHandler::ConvertUpdateStatus(PolicyTableStatus status) {
- switch (status) {
- case policy::StatusUpdatePending:
- return "UPDATING";
- case policy::StatusUpdateRequired:
- return "UPDATE_NEEDED";
- case policy::StatusUpToDate:
- return "UP_TO_DATE";
- default: {
- return "UNKNOWN";
- }
- }
+void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
+ const PermissionConsent& permissions) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AsyncRun(new AppPermissionDelegate(connection_key, permissions));
}
void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
bool is_allowed) {
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
- application_manager::ApplicationManagerImpl::instance()->connection_handler()
+ ApplicationManagerImpl::instance()->connection_handler()
->GetDeviceID(device_id, &device_handle);
// In case of changed consent for device, related applications will be
// limited to pre_DataConsent permissions, if device disallowed, or switch
// back to their own permissions, if device allowed again, and must be
// notified about these changes
- application_manager::ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationList app_list = accessor.applications();
- ApplicationList::const_iterator it_app_list = app_list.begin();
- ApplicationList::const_iterator it_app_list_end = app_list.end();
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ ApplicationManagerImpl::ApplictionSetConstIt it_app_list =
+ accessor.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt 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()->asString();
+ (*it_app_list)->mobile_app_id();
// If app has predata policy, which is assigned without device consent or
// with negative data consent, there no necessity to change smth and send
@@ -448,33 +388,48 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
}
}
+void PolicyHandler::OnPTExchangeNeeded() {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->ForcePTExchange();
+}
+
+void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) {
+ LOG4CXX_INFO(logger_, "GetAvailable apps");
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ const ApplicationManagerImpl::ApplictionSet app_list = accessor.applications();
+ ApplicationManagerImpl::ApplictionSetConstIt iter = app_list.begin();
+
+ for (;app_list.end() != iter; ++iter) {
+ LOG4CXX_INFO(logger_, "one more app");
+ apps.push((*iter)->mobile_app_id());
+ }
+}
+
void PolicyHandler::AddApplication(const std::string& application_id) {
- // TODO (AGaliuzov): remove this workaround during refactoring.
- registration_in_progress = true;
POLICY_LIB_CHECK_VOID();
policy_manager_->AddApplication(application_id);
}
void PolicyHandler::SetDeviceInfo(std::string& device_id,
const DeviceInfo& device_info) {
- LOG4CXX_INFO(logger_, "SetDeviceInfo");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetDeviceInfo(device_id, device_info);
}
-void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
- PermissionConsent &permissions) {
- LOG4CXX_INFO(logger_, "OnAppPermissionConsent");
+void PolicyHandler::OnAppPermissionConsentInternal(
+ const uint32_t connection_key, PermissionConsent &permissions) {
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
if (connection_key) {
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()
->application(connection_key);
if (app.valid()) {
- permissions.policy_app_id = app->mobile_app_id()->asString();
+ permissions.policy_app_id = app->mobile_app_id();
policy::DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForHandle(
+ MessageHelper::GetDeviceInfoForHandle(
app->device(),
&device_params);
@@ -488,6 +443,7 @@ void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
return;
}
+ 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.");
@@ -499,8 +455,8 @@ void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
std::map<std::string, std::string>::const_iterator it_end =
app_to_device_link_.end();
for (;it != it_end; ++it) {
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->
application_by_policy_id(it->first);
// If list of apps sent to HMI for user consents is not the same as current,
@@ -512,7 +468,7 @@ void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
}
policy::DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForHandle(
+ MessageHelper::GetDeviceInfoForHandle(
app->device(),
&device_params);
@@ -531,29 +487,29 @@ void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
void PolicyHandler::OnGetUserFriendlyMessage(
const std::vector<std::string>& message_codes, const std::string& language,
uint32_t correlation_id) {
- LOG4CXX_INFO(logger_, "OnGetUserFriendlyMessage");
+ 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
- application_manager::MessageHelper::SendGetUserFriendlyMessageResponse(
+ MessageHelper::SendGetUserFriendlyMessageResponse(
result, correlation_id);
}
void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
const uint32_t correlation_id) {
- LOG4CXX_INFO(logger_, "OnGetListOfPermissions");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
// If no specific app was passed, get permissions for all currently registered
// applications
if (!connection_key) {
+ sync_primitives::AutoLock lock(app_to_device_link_lock_);
LinkAppToDevice linker(app_to_device_link_);
- application_manager::ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationList app_list = accessor.applications();
- std::set<application_manager::ApplicationSharedPtr>::const_iterator it_app =
- app_list.begin();
- std::set<application_manager::ApplicationSharedPtr>::const_iterator
- it_app_end = app_list.end();
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ ApplicationManagerImpl::ApplictionSetConstIt it_app
+ = accessor.begin();
+ ApplicationManagerImpl::ApplictionSetConstIt it_app_end
+ = accessor.end();
// Add all currently registered applications
std::for_each(it_app, it_app_end, linker);
@@ -568,15 +524,15 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
consolidator.Consolidate(group_permissions);
}
- application_manager::MessageHelper::SendGetListOfPermissionsResponse(
+ MessageHelper::SendGetListOfPermissionsResponse(
consolidator.GetConsolidatedPermissions(), correlation_id);
return;
}
// Single app only
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(
connection_key);
if (!app.valid()) {
@@ -586,7 +542,7 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
}
DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForApp(connection_key,
+ MessageHelper::GetDeviceInfoForApp(connection_key,
&device_params);
std::vector<FunctionalGroupPermission> group_permissions;
if (device_params.device_mac_address.empty()) {
@@ -595,33 +551,31 @@ 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()->asString(),
+ app->mobile_app_id(),
group_permissions);
- application_manager::MessageHelper::SendGetListOfPermissionsResponse(
+ MessageHelper::SendGetListOfPermissionsResponse(
group_permissions, correlation_id);
}
}
void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
- LOG4CXX_INFO(logger_, "OnGetStatusUpdate");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
- policy::PolicyTableStatus status = policy_manager_->GetPolicyTableStatus();
- application_manager::MessageHelper::SendGetStatusUpdateResponse(
- ConvertUpdateStatus(status), correlation_id);
+ MessageHelper::SendGetStatusUpdateResponse(
+ policy_manager_->GetPolicyTableStatus(), correlation_id);
}
-void PolicyHandler::OnUpdateStatusChanged(PolicyTableStatus status) {
- LOG4CXX_INFO(logger_, "OnUpdateStatusChanged");
- application_manager::MessageHelper::SendOnStatusUpdate(
- ConvertUpdateStatus(status));
+void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ MessageHelper::SendOnStatusUpdate(status);
}
std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
const std::string& policy_app_id) {
- LOG4CXX_INFO(logger_, "OnCurrentDeviceIdUpdateRequired");
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()
->application_by_policy_id(policy_app_id);
if (!app.valid()) {
@@ -630,13 +584,13 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
return "";
}
DeviceParams device_param;
- application_manager::MessageHelper::GetDeviceInfoForApp(app->app_id(),
+ MessageHelper::GetDeviceInfoForApp(app->app_id(),
&device_param);
return device_param.device_mac_address;
}
void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
- LOG4CXX_INFO(logger_, "OnSystemInfoChanged");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemLanguage(language);
}
@@ -644,25 +598,25 @@ void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_INFO(logger_, "OnGetSystemInfo");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
}
void PolicyHandler::OnSystemInfoUpdateRequired() {
- LOG4CXX_INFO(logger_, "OnSystemInfoUpdateRequired");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
- application_manager::MessageHelper::SendGetSystemInfoRequest();
+ MessageHelper::SendGetSystemInfoRequest();
}
void PolicyHandler::OnVIIsReady() {
- const uint32_t correlation_id = application_manager::
+ const uint32_t correlation_id =
ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
std::vector<std::string> params;
- params.push_back(application_manager::strings::vin);
+ params.push_back(strings::vin);
- application_manager::MessageHelper::CreateGetVehicleDataRequest(
+ MessageHelper::CreateGetVehicleDataRequest(
correlation_id, params);
}
@@ -672,38 +626,13 @@ void PolicyHandler::OnVehicleDataUpdated(
POLICY_LIB_CHECK_VOID();
}
-void PolicyHandler::OnAppRevoked(const std::string& policy_app_id) {
- LOG4CXX_TRACE(logger_, "OnAppRevoked with policy_app_id " << policy_app_id << " is revoked.");
- POLICY_LIB_CHECK_VOID();
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
- if (app.valid()) {
- DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForApp(app->app_id(),
- &device_params);
- AppPermissions permissions = policy_manager_->GetAppPermissionsChanges(
- device_params.device_mac_address,
- policy_app_id);
- permissions.appRevoked = true;
- application_manager::MessageHelper::SendOnAppPermissionsChangedNotification(
- app->app_id(), permissions);
- app->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
- application_manager::MessageHelper::SendActivateAppToHMI(
- app->app_id(), hmi_apis::Common_HMILevel::NONE);
- application_manager::MessageHelper::SendHMIStatusNotification(*app);
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
- return;
- }
-}
-
void PolicyHandler::OnPendingPermissionChange(
const std::string& policy_app_id) {
- LOG4CXX_INFO(logger_, "PolicyHandler::OnPendingPermissionChange for "
+ LOG4CXX_DEBUG(logger_, "PolicyHandler::OnPendingPermissionChange for "
<< policy_app_id);
POLICY_LIB_CHECK_VOID();
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()
->application_by_policy_id(policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(logger_,
@@ -711,32 +640,46 @@ void PolicyHandler::OnPendingPermissionChange(
return;
}
- DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForApp(app->app_id(),
- &device_params);
AppPermissions permissions = policy_manager_->GetAppPermissionsChanges(
- device_params.device_mac_address,
policy_app_id);
- mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level();
+ const uint32_t app_id = app->app_id();
+
+ using mobile_apis::HMILevel::eType;
+
+ if (permissions.appRevoked) {
+ application_manager::MessageHelper::SendOnAppPermissionsChangedNotification(
+ app_id, permissions);
+
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ eType::HMI_NONE);
+ app->set_audio_streaming_state(mobile_apis::AudioStreamingState::NOT_AUDIBLE);
+ application_manager::MessageHelper::SendActivateAppToHMI(
+ app_id, hmi_apis::Common_HMILevel::NONE);
+ application_manager::MessageHelper::SendHMIStatusNotification(*app);
+ policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ return;
+ }
+
+ eType app_hmi_level = app->hmi_level();
switch (app_hmi_level) {
- case mobile_apis::HMILevel::HMI_FULL:
- case mobile_apis::HMILevel::HMI_LIMITED: {
+ case eType::HMI_FULL:
+ case eType::HMI_LIMITED: {
if (permissions.appPermissionsConsentNeeded) {
- application_manager::MessageHelper::
+ MessageHelper::
SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
break;
}
- case mobile_apis::HMILevel::HMI_BACKGROUND: {
+ case eType::HMI_BACKGROUND: {
if (permissions.isAppPermissionsRevoked) {
- application_manager::MessageHelper::
+ MessageHelper::
SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
break;
}
@@ -747,32 +690,33 @@ void PolicyHandler::OnPendingPermissionChange(
if (permissions.appUnauthorized) {
if (mobile_apis::HMILevel::HMI_FULL == app_hmi_level ||
mobile_apis::HMILevel::HMI_LIMITED == app_hmi_level) {
- application_manager::MessageHelper::
+ MessageHelper::
SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
}
- application_manager::MessageHelper::
+ MessageHelper::
SendOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
- mobile_apis::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
- application_manager::ApplicationManagerImpl::instance()->
- UnregisterRevokedApplication(app->app_id(),
- mobile_apis::Result::INVALID_ENUM);
+ ApplicationManagerImpl::instance()->OnAppUnauthorized(app->app_id());
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
}
-bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string) {
- LOG4CXX_INFO(logger_, "PolicyHandler::SendMessageToSDK");
+bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url) {
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
- std::string url;
+ if (last_used_app_ids_.empty()) {
+ LOG4CXX_WARN(logger_, "last_used_app_ids_ is empty");
+ return false;
+ }
uint32_t app_id = last_used_app_ids_.back();
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
- ->application(app_id);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app.valid()) {
LOG4CXX_WARN(logger_, "There is no registered application with "
@@ -780,21 +724,19 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string) {
return false;
}
- const std::string& mobile_app_id = app->mobile_app_id()->asString();
+ const std::string& mobile_app_id = app->mobile_app_id();
if (mobile_app_id.empty()) {
LOG4CXX_WARN(logger_, "Application with connection key '" << app_id << "'"
" has no application id.");
return false;
}
- url = policy_manager_->GetUpdateUrl(PolicyServiceTypes::POLICY);
- LOG4CXX_INFO(logger_, "Update url is " << url << " for application "
- << application_manager::ApplicationManagerImpl::instance()
+ LOG4CXX_DEBUG(logger_, "Update url is " << url << " for application "
+ << ApplicationManagerImpl::instance()
->application(app_id)->name());
- application_manager::MessageHelper::SendPolicySnapshotNotification(app_id,
- pt_string,
- url, 0);
+ MessageHelper::SendPolicySnapshotNotification(
+ app_id, pt_string, url, 0);
return true;
}
@@ -803,24 +745,16 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) {
POLICY_LIB_CHECK(false);
- if (policy_manager_->GetPolicyTableStatus() !=
- PolicyTableStatus::StatusUpdatePending) {
- LOG4CXX_WARN(logger_, "PTU processing skipped, since current status is "
- "different from pending.");
- return false;
- }
-
bool ret = policy_manager_->LoadPT(file, pt_string);
LOG4CXX_INFO(logger_, "Policy table is saved: " << std::boolalpha << ret);
if (ret) {
LOG4CXX_INFO(logger_, "PTU was successful.");
- exchange_handler_->Stop();
policy_manager_->CleanupUnpairedDevices();
int32_t correlation_id =
- application_manager::ApplicationManagerImpl::instance()
+ ApplicationManagerImpl::instance()
->GetNextHMICorrelationID();
- event_observer_.get()->subscribe_on_event(
+ event_observer_->subscribe_on_event(
#ifdef HMI_DBUS_API
hmi_apis::FunctionID::VehicleInfo_GetOdometer, correlation_id
#else
@@ -828,8 +762,8 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
#endif
);
std::vector<std::string> vehicle_data_args;
- vehicle_data_args.push_back(application_manager::strings::odometer);
- application_manager::MessageHelper::CreateGetVehicleDataRequest(
+ vehicle_data_args.push_back(strings::odometer);
+ MessageHelper::CreateGetVehicleDataRequest(
correlation_id, vehicle_data_args);
} else {
LOG4CXX_WARN(logger_, "Exchange wasn't successful, trying another one.");
@@ -839,68 +773,36 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
}
bool PolicyHandler::UnloadPolicyLibrary() {
- LOG4CXX_TRACE(logger_, "enter. policy_manager_ = " << policy_manager_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "policy_manager_ = " << policy_manager_);
bool ret = true;
+ AsyncRunner::Stop();
+ sync_primitives::AutoWriteLock lock(policy_manager_lock_);
if (policy_manager_) {
- policy_manager_.release();
+ policy_manager_.reset();
}
if (dl_handle_) {
ret = (dlclose(dl_handle_) == 0);
dl_handle_ = 0;
}
- exchange_handler_->Stop();
LOG4CXX_TRACE(logger_, "exit");
return ret;
}
-void PolicyHandler::StartPTExchange(bool skip_device_selection) {
- LOG4CXX_INFO(logger_, "PolicyHandler::StartPTExchange");
- POLICY_LIB_CHECK_VOID();
-
- if (policy_manager_->GetPolicyTableStatus() ==
- PolicyTableStatus::StatusUpdatePending) {
- LOG4CXX_INFO(logger_, "Starting exchange skipped, since another exchange "
- "is in progress.");
- return;
- }
-
- if (!skip_device_selection) {
- DeviceParams device_params;
- DeviceConsent consent = GetDeviceForSending(device_params);
- switch (consent) {
- case kDeviceHasNoConsent:
- // Send OnSDLConsentNeeded to HMI for user consent on device usage
- pending_device_handles_.push_back(device_params.device_handle);
- application_manager::MessageHelper::SendOnSDLConsentNeeded(
- device_params);
- return;
- case kDeviceDisallowed:
- return;
- default:
- break;
- }
- }
-
- exchange_handler_->Start();
-}
-
void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
uint32_t device_id) {
- LOG4CXX_INFO(logger_, "OnAllowSDLFunctionalityNotification");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
// Device ids, need to be changed
std::set<uint32_t> device_ids;
bool device_specific = device_id != 0;
// Common devices consents change
if (!device_specific) {
- application_manager::ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<application_manager::ApplicationSharedPtr> app_list =
- accessor.applications();
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ const ApplicationManagerImpl::ApplictionSet app_list = accessor.applications();
- std::set<application_manager::ApplicationSharedPtr>::const_iterator
- it_app_list = app_list.begin();
- std::set<application_manager::ApplicationSharedPtr>::const_iterator
- it_app_end = app_list.end();
+ 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()) {
@@ -918,7 +820,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
const uint32_t device_id = *it_ids;
DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForHandle(device_id,
+ MessageHelper::GetDeviceInfoForHandle(device_id,
&device_params);
device_params.device_handle = device_id;
if (kDefaultDeviceMacAddress == device_params.device_mac_address) {
@@ -944,139 +846,80 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
pending_device_handles_.erase(it);
}
-// EXTENDED_POLICY
- // Skip device selection, since user already consented device usage
- StartPTExchange(true);
}
void PolicyHandler::OnIgnitionCycleOver() {
- LOG4CXX_INFO(logger_, "OnIgnitionCycleOver");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->IncrementIgnitionCycles();
}
-void PolicyHandler::KmsChanged(int kms) {
- LOG4CXX_INFO(logger_, "PolicyHandler::KmsChanged " << kms << " kilometers");
- POLICY_LIB_CHECK_VOID();
- PTExchangeAtOdometer(kms);
-}
-
void PolicyHandler::OnActivateApp(uint32_t connection_key,
uint32_t correlation_id) {
- LOG4CXX_INFO(logger_, "OnActivateApp");
+ LOG4CXX_AUTO_TRACE(logger_);
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->application(
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->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()->asString();
+ std::string policy_app_id = app->mobile_app_id();
AppPermissions permissions(policy_app_id);
+ sync_primitives::AutoReadLock lock(policy_manager_lock_);
if (!policy_manager_) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
+ LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded");
if (!PolicyEnabled()) {
permissions.isSDLAllowed = true;
}
} else {
- DeviceParams device_params;
- application_manager::MessageHelper::GetDeviceInfoForApp(connection_key,
- &device_params);
permissions = policy_manager_->GetAppPermissionsChanges(
- device_params.device_mac_address,
policy_app_id);
permissions.isSDLAllowed = true;
-
- if (permissions.isSDLAllowed &&
- PolicyTableStatus::StatusUpdateRequired ==
- policy_manager_->GetPolicyTableStatus()) {
- StartPTExchange();
- }
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
-
- bool is_app_activated = false;
// If application is revoked it should not be activated
// In this case we need to activate application
if (false == permissions.appRevoked && true == permissions.isSDLAllowed) {
- is_app_activated =
- application_manager::ApplicationManagerImpl::instance()->
- ActivateApplication(app);
- }
-
- last_activated_app_id_ = connection_key;
- application_manager::MessageHelper::SendSDLActivateAppResponse(permissions,
- correlation_id);
- if (is_app_activated) {
- application_manager::MessageHelper::SendHMIStatusNotification(*app.get());
+ LOG4CXX_INFO(logger_, "Application will be activated");
+ if (ApplicationManagerImpl::instance()->ActivateApplication(app)) {
+ MessageHelper::SendHMIStatusNotification(*(app.get()));
+ last_activated_app_id_ = 0;
+ }
+ } else {
+ LOG4CXX_INFO(logger_, "Application should not be activated");
}
-}
-void PolicyHandler::PTExchangeAtRegistration(const std::string& app_id) {
- LOG4CXX_INFO(logger_, "PTExchangeAtIgnition");
- POLICY_LIB_CHECK_VOID();
-
- if (policy_manager_->IsAppInUpdateList(app_id)) {
- StartPTExchange();
- } else if (false == on_ignition_check_done_) { // TODO(AG): add cond. var to handle this case.
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- const int kSecondsInDay = 60 * 60 * 24;
- int days = current_time.tv_sec / kSecondsInDay;
-
- LOG4CXX_INFO(
- logger_,
- "\nIgnition cycles exceeded: " << std::boolalpha <<
- policy_manager_->ExceededIgnitionCycles()
- << "\nDays exceeded: " << std::boolalpha
- << policy_manager_->ExceededDays(days)
- << "\nStatusUpdateRequired: " << std::boolalpha
- << (policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired));
- if (policy_manager_->ExceededIgnitionCycles()
- || policy_manager_->ExceededDays(days)
- || policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired) {
- StartPTExchange();
- }
- }
- on_ignition_check_done_ = true;
+ MessageHelper::SendSDLActivateAppResponse(permissions, correlation_id);
}
-void PolicyHandler::PTExchangeAtOdometer(int kilometers) {
+void PolicyHandler::KmsChanged(int kilometers) {
+ LOG4CXX_DEBUG(logger_, "PolicyHandler::KmsChanged " << kilometers << " kilometers");
POLICY_LIB_CHECK_VOID();
- if (policy_manager_->ExceededKilometers(kilometers)) {
- LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update.");
- StartPTExchange();
- }
+ policy_manager_->KmsChanged(kilometers);
}
void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
LOG4CXX_TRACE(logger_, "PT exchange at user request");
POLICY_LIB_CHECK_VOID();
- policy::PolicyTableStatus status = policy_manager_->GetPolicyTableStatus();
- if (status != policy::StatusUpdatePending) {
- OnPTExchangeNeeded();
- status = policy::StatusUpdatePending;
- } else {
- is_user_requested_policy_table_update_ = true;
- }
- application_manager::MessageHelper::SendUpdateSDLResponse(
- ConvertUpdateStatus(status), correlation_id);
-}
-
-void PolicyHandler::OnPTExchangeNeeded() {
- StartPTExchange();
+ std::string update_status = policy_manager_->ForcePTExchange();
+ MessageHelper::SendUpdateSDLResponse(update_status,
+ correlation_id);
}
void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) {
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ OnPermissionsUpdated(policy_app_id, permissions);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()
+ ->application_by_policy_id(policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(
logger_,
@@ -1084,19 +927,11 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
return;
}
- application_manager::MessageHelper::SendOnPermissionsChangeNotification(
- app->app_id(), permissions);
-
- LOG4CXX_INFO(
- logger_,
- "Notification sent for application_id:" << policy_app_id
- << " and connection_key " << app->app_id());
-
// The application currently not running (i.e. in NONE) should change HMI
// level to default
mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level();
mobile_apis::HMILevel::eType hmi_level =
- application_manager::MessageHelper::StringToHMILevel(default_hmi);
+ MessageHelper::StringToHMILevel(default_hmi);
if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) {
LOG4CXX_WARN(logger_, "Couldn't convert default hmi level "
@@ -1104,7 +939,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
return;
}
if (current_hmi_level == hmi_level) {
- LOG4CXX_INFO(logger_, "Application already in default hmi state.");
+ LOG4CXX_DEBUG(logger_, "Application already in default hmi state.");
return;
}
switch (current_hmi_level) {
@@ -1115,17 +950,16 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
// If default is FULL, send request to HMI. Notification to mobile will be
// sent on response receiving.
if (mobile_apis::HMILevel::HMI_FULL == hmi_level) {
- application_manager::MessageHelper::SendActivateAppToHMI(app->app_id());
- break;
- }
-
- // Set application hmi level
- app->set_hmi_level(hmi_level);
-
- // Send notification to mobile
- application_manager::MessageHelper::SendHMIStatusNotification(*app.get());
+ MessageHelper::SendActivateAppToHMI(app->app_id());
+ } else {
+ // Set application hmi level
+ ApplicationManagerImpl::instance()->ChangeAppsHMILevel(app->app_id(),
+ hmi_level);
+ // If hmi Level is full, it will be seted after ActivateApp response
+ MessageHelper::SendHMIStatusNotification(*app.get());
}
break;
+ }
default:
LOG4CXX_WARN(logger_, "Application " << policy_app_id << " is running."
"HMI level won't be changed.");
@@ -1133,6 +967,54 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
}
}
+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);
+ if (!app.valid()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
+ return;
+ }
+
+ MessageHelper::SendOnPermissionsChangeNotification(
+ app->app_id(), permissions);
+
+ 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();
+ snap_path = system_files_path + '/' + policy_snapshot_file_name;
+
+ bool result = false;
+ if (file_system::CreateDirectoryRecursively(system_files_path)) {
+ result = file_system::WriteBinaryFile(snap_path, pt_string);
+ }
+
+ if (!result) {
+ LOG4CXX_ERROR(logger_, "Failed to write snapshot file to " << snap_path);
+ }
+
+ return result;
+}
+
+void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
+ const std::vector<int>& retry_delay_seconds,
+ int timeout_exchange) {
+ SendMessageToSDK(pt_string, policy_manager_->GetUpdateUrl(POLICY));
+}
+
bool PolicyHandler::GetPriority(const std::string& policy_app_id,
std::string* priority) {
POLICY_LIB_CHECK(false);
@@ -1172,14 +1054,9 @@ bool PolicyHandler::GetInitialAppData(const std::string& application_id,
return policy_manager_->GetInitialAppData(application_id, nicknames, app_hmi_types);
}
-EndpointUrls PolicyHandler::GetUpdateUrls(int service_type) {
- POLICY_LIB_CHECK(EndpointUrls());
- return policy_manager_->GetUpdateUrls(service_type);
-}
-
-std::string PolicyHandler::GetLockScreenIconUrl() const {
- POLICY_LIB_CHECK(std::string(""));
- return policy_manager_->GetLockScreenIconUrl();
+void PolicyHandler::GetUpdateUrls(int service_type, EndpointUrls& end_points) {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetUpdateUrls(service_type, end_points);
}
void PolicyHandler::ResetRetrySequence() {
@@ -1202,14 +1079,24 @@ void PolicyHandler::OnExceededTimeout() {
policy_manager_->OnExceededTimeout();
}
-BinaryMessageSptr PolicyHandler::RequestPTUpdate() {
- POLICY_LIB_CHECK(BinaryMessageSptr());
- return policy_manager_->RequestPTUpdate();
+void PolicyHandler::OnSystemReady() {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->OnSystemReady();
+}
+
+void PolicyHandler::PTUpdatedAt(int kilometers, int days_after_epoch) {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->PTUpdatedAt(kilometers, days_after_epoch);
+}
+
+void PolicyHandler::add_listener(PolicyHandlerObserver* listener) {
+ sync_primitives::AutoLock lock(listeners_lock_);
+ listeners_.push_back(listener);
}
-const std::vector<int> PolicyHandler::RetrySequenceDelaysSeconds() {
- POLICY_LIB_CHECK(std::vector<int>());
- return policy_manager_->RetrySequenceDelaysSeconds();
+void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) {
+ sync_primitives::AutoLock lock(listeners_lock_);
+ listeners_.remove(listener);
}
utils::SharedPtr<usage_statistics::StatisticsManager>
@@ -1254,8 +1141,8 @@ void PolicyHandler::OnSystemError(int code) {
}
std::string PolicyHandler::GetAppName(const std::string& policy_app_id) {
- application_manager::ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()
->application_by_policy_id(policy_app_id);
if (!app.valid()) {
@@ -1267,22 +1154,30 @@ std::string PolicyHandler::GetAppName(const std::string& policy_app_id) {
return app->name();
}
-void PolicyHandler::OnUserRequestedUpdateCheckRequired() {
- LOG4CXX_INFO(logger_, "OnUserRequestedUpdateCheckRequired");
- POLICY_LIB_CHECK_VOID();
- policy::PolicyTableStatus status = policy_manager_->GetPolicyTableStatus();
- if (is_user_requested_policy_table_update_ &&
- status != policy::StatusUpdatePending) {
- is_user_requested_policy_table_update_ = false;
- OnPTExchangeNeeded();
- return;
+void PolicyHandler::OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(listeners_lock_);
+ HandlersCollection::const_iterator it = listeners_.begin();
+ for (; it != listeners_.end(); ++it) {
+ (*it)->OnUpdateHMIAppType(app_hmi_types);
+ }
+}
+
+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);
}
- LOG4CXX_WARN(logger_, "There is another pending update is present."
- "User-requested update is postponed.");
+}
+
+bool PolicyHandler::CanUpdate() {
+ return 0 != GetAppIdForSending();
}
void PolicyHandler::RemoveDevice(const std::string& device_id) {
- LOG4CXX_INFO(logger_, "PolicyHandler::RemoveDevice");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->MarkUnpairedDevice(device_id);
@@ -1297,27 +1192,38 @@ bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) {
}
void PolicyHandler::OnUpdateRequestSentToMobile() {
- LOG4CXX_INFO(logger_, "OnUpdateRequestSentToMobile");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
policy_manager_->OnUpdateStarted();
}
-bool PolicyHandler::CheckKeepContext(int system_action,
- const std::string& policy_app_id) {
+bool PolicyHandler::CheckKeepContext(const std::string& policy_app_id) {
POLICY_LIB_CHECK(false);
- const bool keep_context = system_action
- == mobile_apis::SystemAction::KEEP_CONTEXT;
- const bool allowed = policy_manager_->CanAppKeepContext(policy_app_id);
- return !(keep_context && !allowed);
+ return policy_manager_->CanAppKeepContext(policy_app_id);
}
-bool PolicyHandler::CheckStealFocus(int system_action,
- const std::string& policy_app_id) {
+bool PolicyHandler::CheckStealFocus(const std::string& policy_app_id) {
POLICY_LIB_CHECK(false);
- const bool steal_focus = system_action
- == mobile_apis::SystemAction::STEAL_FOCUS;
- const bool allowed = policy_manager_->CanAppStealFocus(policy_app_id);
- return !(steal_focus && !allowed);
+ return policy_manager_->CanAppStealFocus(policy_app_id);
+}
+
+bool PolicyHandler::CheckSystemAction(
+ mobile_apis::SystemAction::eType system_action,
+ const std::string& policy_app_id) {
+ 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;
+ }
+ LOG4CXX_DEBUG(logger_, "Unknown system action");
+ return false;
}
uint16_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
@@ -1325,6 +1231,22 @@ uint16_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
return policy_manager_->HeartBeatTimeout(app_id);
}
+const std::string PolicyHandler::RemoteAppsUrl() const {
+ const std::string default_url = "";
+ POLICY_LIB_CHECK(default_url);
+ return policy_manager_->RemoteAppsUrl();
+}
+
+void policy::PolicyHandler::OnAppsSearchStarted() {
+ POLICY_LIB_CHECK();
+ policy_manager_->OnAppsSearchStarted();
+}
+
+void policy::PolicyHandler::OnAppsSearchCompleted() {
+ POLICY_LIB_CHECK();
+ policy_manager_->OnAppsSearchCompleted();
+}
+
void PolicyHandler::Increment(usage_statistics::GlobalCounterId type) {
POLICY_LIB_CHECK();
policy_manager_->Increment(type);
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index 5faabde458..c4a2fabb71 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "utils/logger.h"
#include "config_profile/profile.h"
#include "application_manager/request_controller.h"
@@ -48,76 +47,59 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController");
RequestController::RequestController()
: pool_state_(UNDEFINED),
pool_size_(profile::Profile::instance()->thread_pool_size()),
- pending_request_set_lock_(true),
- timer_("RequestCtrlTimer", this, &RequestController::onTimer, true)
-{
- LOG4CXX_INFO(logger_, "RequestController::RequestController()");
+ timer_("RequestCtrlTimer", this, &RequestController::onTimer, true),
+ is_low_voltage_(false) {
+ LOG4CXX_AUTO_TRACE(logger_);
InitializeThreadpool();
timer_.start(dafault_sleep_time_);
- LOG4CXX_DEBUG(logger_," Create timer thread ; timer thread = " << timer_.thread_->thread_handle());
}
RequestController::~RequestController() {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
if (pool_state_ != TPoolState::STOPPED) {
DestroyThreadpool();
}
-
- pool_.clear();
- mobile_request_list_.clear();
- pending_request_set_.clear();
}
-void RequestController::InitializeThreadpool()
-{
- LOG4CXX_TRACE_ENTER(logger_);
- // TODO: Consider lazy loading threads instead of creating all at once
+void RequestController::InitializeThreadpool() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ // TODO(DK): Consider lazy loading threads instead of creating all at once
pool_state_ = TPoolState::STARTED;
+ char name[50];
for (uint32_t i = 0; i < pool_size_; i++) {
- char name [50];
- 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_INFO(logger_, "Request thread initialized: " << name);
+ LOG4CXX_DEBUG(logger_, "Request thread initialized: " << name);
}
}
void RequestController::DestroyThreadpool() {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
{
- sync_primitives::AutoLock auto_lock (mobile_request_list_lock_);
+ AutoLock auto_lock(mobile_request_list_lock_);
pool_state_ = TPoolState::STOPPED;
- LOG4CXX_INFO(logger_, "Broadcasting STOP signal to all threads...");
- cond_var_.Broadcast(); // notify all threads we are shutting down
+ LOG4CXX_DEBUG(logger_, "Broadcasting STOP signal to all threads...");
+ cond_var_.Broadcast(); // notify all threads we are shutting down
}
- for (uint32_t i = 0; i < pool_size_; i++) {
- pool_[i]->stop();
- threads::DeleteThread(pool_[i]);
+ for (size_t i = 0; i < pool_.size(); i++) {
+ threads::Thread* thread = pool_[i];
+ thread->join();
+ delete thread->delegate();
+ threads::DeleteThread(thread);
}
- LOG4CXX_INFO(logger_, "Threads exited from the thread pool " << pool_size_);
+ pool_.clear();
}
-RequestController::TResult RequestController::addMobileRequest(
- const MobileRequestPtr& request,
- const mobile_apis::HMILevel::eType& hmi_level) {
- LOG4CXX_TRACE_ENTER(logger_);
- if (!request.valid()) {
- LOG4CXX_INFO(logger_, "Null Pointer request");
- LOG4CXX_TRACE_EXIT(logger_);
- cond_var_.NotifyOne();
- return INVALID_DATA;
- }
-
- TResult result = SUCCESS;
- const commands::CommandRequestImpl* request_impl =
- static_cast<commands::CommandRequestImpl*>(request.get());
- LOG4CXX_DEBUG(logger_, "addMobileRequest " << request_impl->correlation_id());
+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();
- const uint32_t& app_hmi_level_none_max_request_per_time_scale =
- profile::Profile::instance()->app_hmi_level_none_time_scale_max_requests();
+ // 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();
const uint32_t& app_time_scale =
profile::Profile::instance()->app_time_scale();
@@ -128,244 +110,283 @@ RequestController::TResult RequestController::addMobileRequest(
const uint32_t& pending_requests_amount =
profile::Profile::instance()->pending_requests_amount();
- if (!checkHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::HMI_NONE,
- request_impl->connection_key(),
+ if (!CheckPendingRequestsAmount(pending_requests_amount)) {
+ LOG4CXX_ERROR(logger_, "Too many pending request");
+ return RequestController::TOO_MANY_PENDING_REQUESTS;
+ }
+
+ if (!waiting_for_response_.CheckHMILevelTimeScaleMaxRequest(
+ mobile_apis::HMILevel::HMI_NONE,
+ request->connection_key(),
app_hmi_level_none_time_scale,
- app_hmi_level_none_max_request_per_time_scale)) {
+ hmi_level_none_count)) {
LOG4CXX_ERROR(logger_, "Too many application requests in hmi level NONE");
- result = RequestController::NONE_HMI_LEVEL_MANY_REQUESTS;
- } else if (!checkTimeScaleMaxRequest(
- request_impl->connection_key(),
- app_time_scale, max_request_per_time_scale)) {
+ return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS;
+ }
+ if (!waiting_for_response_.CheckTimeScaleMaxRequest(request->connection_key(),
+ app_time_scale,
+ max_request_per_time_scale)) {
LOG4CXX_ERROR(logger_, "Too many application requests");
- result = RequestController::TOO_MANY_REQUESTS;
- } else if (pending_requests_amount == mobile_request_list_.size()) {
- LOG4CXX_ERROR(logger_, "Too many pending request");
- result = RequestController::TOO_MANY_PENDING_REQUESTS;
+ return RequestController::TOO_MANY_REQUESTS;
}
- {
- AutoLock auto_lock(mobile_request_list_lock_);
+ return SUCCESS;
+}
- mobile_request_list_.push_back(request);
- LOG4CXX_INFO(logger_, "mobile_request_list_ size is "
- << mobile_request_list_.size()
- << " pending_request_set_ size is "
- << pending_request_set_.size()
- );
+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_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);
+ }
+ return available_to_add;
}
+ LOG4CXX_DEBUG(logger_, "CheckPendingRequestsAmount disabled");
+ return true;
+}
+RequestController::TResult RequestController::addMobileRequest(
+ 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());
+ RequestController::TResult result = CheckPosibilitytoAdd(request);
+ 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();
- LOG4CXX_TRACE_EXIT(logger_);
return result;
}
RequestController::TResult RequestController::addHMIRequest(
const RequestPtr request) {
- LOG4CXX_TRACE_ENTER(logger_);
- DCHECK(request.valid());
- LOG4CXX_DEBUG(logger_, "addHMIRequest " << request->correlation_id());
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!request.valid()) {
+ LOG4CXX_ERROR(logger_, "HMI request pointer is invalid");
+ return RequestController::INVALID_DATA;
+ }
+ LOG4CXX_DEBUG(logger_, " correlation_id : " << request->correlation_id());
- 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 uint32_t timeout_in_seconds =
+ request->default_timeout() / date_time::DateTime::MILLISECONDS_IN_SECOND;
+ RequestInfoPtr request_info_ptr(new HMIRequestInfo(request,
+ timeout_in_seconds));
if (0 != timeout_in_seconds) {
- pending_request_set_lock_.Acquire();
- pending_request_set_.insert(request_info_ptr);
- LOG4CXX_INFO(logger_, "pending_request_set_ size is "
- << pending_request_set_.size());
- UpdateTimer();
- pending_request_set_lock_.Release();
+ 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.");
}
- LOG4CXX_TRACE_EXIT(logger_);
+ UpdateTimer();
return RequestController::SUCCESS;
}
void RequestController::addNotification(const RequestPtr ptr) {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
notification_list_.push_back(ptr);
- LOG4CXX_TRACE_EXIT(logger_);
}
-void RequestController::removeNotification(const commands::Command* notification) {
- LOG4CXX_TRACE_ENTER(logger_);
+void RequestController::removeNotification(
+ const commands::Command* notification) {
+ LOG4CXX_AUTO_TRACE(logger_);
std::list<RequestPtr>::iterator it = notification_list_.begin();
- for (; notification_list_.end() != it; ++it) {
+ for (; notification_list_.end() != it; ) {
if (it->get() == notification) {
- notification_list_.erase(it);
+ notification_list_.erase(it++);
+ LOG4CXX_DEBUG(logger_, "Notification removed");
break;
+ } else {
+ ++it;
}
}
- LOG4CXX_TRACE_EXIT(logger_);
+ LOG4CXX_DEBUG(logger_, "Cant find notification");
}
-void RequestController::terminateMobileRequest(
- const uint32_t& mobile_correlation_id) {
- LOG4CXX_TRACE_ENTER(logger_);
-
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator it = pending_request_set_.begin();
- for (; pending_request_set_.end() != it; ++it) {
- RequestInfo* mobile_request_info = it->get();
- if (NULL == mobile_request_info) {
- continue;
- }
- if (mobile_correlation_id == mobile_request_info->requestId()) {
- mobile_request_info->request()->CleanUp();
- pending_request_set_.erase(it);
- LOG4CXX_INFO(logger_, "Mobile request terminated: " << mobile_correlation_id <<
- " pending_request_set_ size : " << pending_request_set_.size());
- UpdateTimer();
- LOG4CXX_TRACE_EXIT(logger_);
- return;
- }
+void RequestController::terminateRequest(
+ const uint32_t& correlation_id,
+ const uint32_t& connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "correlation_id = " << correlation_id
+ << " connection_key = " << connection_key);
+ RequestInfoPtr request = waiting_for_response_.Find(connection_key,
+ correlation_id);
+ if (request) {
+ waiting_for_response_.RemoveRequest(request);
+ UpdateTimer();
+ } else {
+ LOG4CXX_WARN(logger_, "Request not found in waiting_for_response_ : "
+ << correlation_id);
}
- LOG4CXX_INFO(logger_, "Mobile request NOT terminated: " << mobile_correlation_id <<
- " pending_request_set_ size : " << pending_request_set_.size());
- LOG4CXX_TRACE_EXIT(logger_);
+}
+
+void RequestController::terminateMobileRequest(
+ const uint32_t& mobile_correlation_id,
+ const uint32_t& connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ terminateRequest(mobile_correlation_id, connection_key);
}
void RequestController::terminateHMIRequest(const uint32_t &correlation_id) {
- LOG4CXX_TRACE_ENTER(logger_);
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator it = pending_request_set_.begin();
- for (; pending_request_set_.end() != it; ++it) {
- RequestInfo* hmi_request_info = it->get();
- if (NULL == hmi_request_info) {
- continue;
- }
- if (correlation_id == hmi_request_info->requestId()) {
- hmi_request_info->request()->CleanUp();
- pending_request_set_.erase(it);
- LOG4CXX_DEBUG(logger_, "HMI request terminated: " << correlation_id);
- UpdateTimer();
- LOG4CXX_TRACE_EXIT(logger_);
- return;
- }
- }
- LOG4CXX_INFO(logger_, "HMI request NOT terminated: " << correlation_id <<
- " pending_request_set_ size : " << pending_request_set_.size());
- LOG4CXX_TRACE_EXIT(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ terminateRequest(correlation_id, RequestInfo::HmiConnectoinKey);
}
-void RequestController::terminateAppRequests(
+void RequestController::terminateWaitingForExecutionAppRequests(
const uint32_t& app_id) {
- LOG4CXX_TRACE_ENTER(logger_);
-
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator it = pending_request_set_.begin();
- while (pending_request_set_.end() != it) {
- RequestInfo* mobile_request_info = it->get();
- if (NULL == mobile_request_info) {
- ++it;
- continue;
- }
-
- if (mobile_request_info->app_id() == app_id) {
- mobile_request_info->request()->CleanUp();
- pending_request_set_.erase(it++);
- LOG4CXX_INFO(logger_, "terminated all app requests : " << app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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 {
- ++it;
+ ++request_it;
}
}
+ 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());
+}
+
+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_list_.size()
+ << "Requests waiting for response count : "
+ << waiting_for_response_.Size());
+
+ terminateWaitingForExecutionAppRequests(app_id);
+ terminateWaitingForResponseAppRequests(app_id);
UpdateTimer();
- LOG4CXX_TRACE_EXIT(logger_);
}
void RequestController::terminateAllHMIRequests() {
- LOG4CXX_TRACE_ENTER(logger_);
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator it = pending_request_set_.begin();
- while (pending_request_set_.end() != it) {
- RequestInfo* hmi_request_info = it->get();
- if (NULL == hmi_request_info) {
- ++it;
- continue;
- }
- hmi_request_info->request()->CleanUp();
- pending_request_set_.erase(it++);
- LOG4CXX_INFO(logger_, "HMI request terminated: ");
- }
- LOG4CXX_TRACE_EXIT(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectoinKey);
+}
+
+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_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& mobile_correlation_id,
+ const uint32_t& correlation_id,
const uint32_t& new_timeout) {
-
- LOG4CXX_TRACE_ENTER(logger_);
-
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator it = pending_request_set_.begin();
- RequestInfo* mobile_request_info = NULL;
- RequestInfoPtr request_info;
- for (; pending_request_set_.end() != it; ++it) {
- request_info = *it;
- if (false == request_info.valid()) {
- LOG4CXX_ERROR(logger_, "Invalid request, can't update timeout");
- continue;
- }
- mobile_request_info = request_info.get();
- if (NULL == mobile_request_info) {
- continue;
- }
- if (app_id == mobile_request_info->app_id() &&
- mobile_correlation_id == mobile_request_info->requestId()) {
- break;
- }
- }
-
- if (it != pending_request_set_.end()) {
- DCHECK(mobile_request_info);
- DCHECK(request_info.valid());
-
- uint32_t timeout_in_seconds = new_timeout/date_time::DateTime::MILLISECONDS_IN_SECOND;
- mobile_request_info->updateTimeOut(timeout_in_seconds);
- pending_request_set_.erase(it);
- pending_request_set_.insert(request_info);
- // erase and insert need to update ordering of set
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "app_id : " << app_id
+ << " mobile_correlation_id : " << correlation_id
+ << " new_timeout : " << new_timeout);
+ 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);
+ waiting_for_response_.Add(request_info);
UpdateTimer();
- LOG4CXX_ERROR(logger_, "Timeout updated for "
+ LOG4CXX_INFO(logger_, "Timeout updated for "
<< " app_id " << app_id
- << " mobile_correlation_id " << mobile_correlation_id
+ << " correlation_id " << correlation_id
<< " new_timeout " << new_timeout);
} else {
LOG4CXX_ERROR(logger_, "Can't find request with "
<< " app_id " << app_id
- << " mobile_correlation_id " << mobile_correlation_id );
+ << " correlation_id " << correlation_id);
}
}
+void RequestController::OnLowVoltage() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_low_voltage_ = true;
+}
+
+void RequestController::OnWakeUp() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ terminateAllHMIRequests();
+ terminateAllMobileRequests();
+ is_low_voltage_ = false;
+ LOG4CXX_DEBUG(logger_, "Terminate old requests done");
+}
+
+bool RequestController::IsLowVoltage() {
+ LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_);
+ return is_low_voltage_;
+}
+
void RequestController::onTimer() {
- LOG4CXX_TRACE_ENTER(logger_);
- AutoLock auto_lock(pending_request_set_lock_);
- RequestInfoSet::iterator probably_expired = pending_request_set_.begin();
- while (pending_request_set_.end() != probably_expired) {
- RequestInfoPtr request = *probably_expired;
- if (request->timeout_sec() == 0) {
- LOG4CXX_INFO(logger_, "Ignore " << request->requestId());
- ++probably_expired;
- // This request should not be observed for TIME_OUT
- continue;
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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");
+ 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());
+ waiting_for_response_.RemoveRequest(probably_expired);
}
- if (request->isExpired()) {
- pending_request_set_.erase(probably_expired);
- request->request()->onTimeOut();
- request->request()->CleanUp();
- LOG4CXX_INFO(logger_, "Timeout for request id " << request->requestId() << " expired");
- probably_expired = pending_request_set_.begin();
- break;
+ probably_expired = waiting_for_response_.FrontWithNotNullTimeout();
+ if (probably_expired) {
+ if (experied_request_id == probably_expired->requestId() &&
+ experied_app_id == probably_expired->app_id()) {
+ LOG4CXX_DEBUG(logger_, "Expired request wasn't removed");
+ break;
+ }
}
}
UpdateTimer();
- LOG4CXX_TRACE_EXIT(logger_);
+ LOG4CXX_DEBUG(logger_, "EXIT Waiting for response count : "
+ << waiting_for_response_.Size());
}
RequestController::Worker::Worker(RequestController* requestController)
@@ -377,14 +398,14 @@ RequestController::Worker::~Worker() {
}
void RequestController::Worker::threadMain() {
- LOG4CXX_TRACE_ENTER(logger_);
- sync_primitives::AutoLock auto_lock(thread_lock_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ AutoLock auto_lock(thread_lock_);
while (!stop_flag_) {
// Try to pick a request
- sync_primitives::AutoLock auto_lock(request_controller_->mobile_request_list_lock_);
+ AutoLock auto_lock(request_controller_->mobile_request_list_lock_);
while ((request_controller_->pool_state_ != TPoolState::STOPPED) &&
- (request_controller_->mobile_request_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");
@@ -397,117 +418,73 @@ void RequestController::Worker::threadMain() {
break;
}
- MobileRequestPtr request(request_controller_->mobile_request_list_.front());
+ if (request_controller_->mobile_request_list_.empty()) {
+ LOG4CXX_WARN(logger_, "Mobile request list is empty");
+ break;
+ }
+ RequestPtr request(request_controller_->mobile_request_list_.front());
request_controller_->mobile_request_list_.pop_front();
- bool init_res = request->Init(); // to setup specific default timeout
+ bool init_res = request->Init(); // to setup specific default timeout
- uint32_t timeout_in_seconds = request->default_timeout()/date_time::DateTime::MILLISECONDS_IN_SECOND;
+ const uint32_t timeout_in_seconds =
+ request->default_timeout() / date_time::DateTime::MILLISECONDS_IN_SECOND;
RequestInfoPtr request_info_ptr(new MobileRequestInfo(request,
timeout_in_seconds));
- request_controller_->pending_request_set_lock_.Acquire();
- request_controller_->pending_request_set_.insert(request_info_ptr);
+ request_controller_->waiting_for_response_.Add(request_info_ptr);
if (0 != timeout_in_seconds) {
- LOG4CXX_INFO(logger_, "Add Request " << request_info_ptr->requestId() <<
+ LOG4CXX_INFO(logger_, "Execute MobileRequest corr_id = "
+ << request_info_ptr->requestId() <<
" with timeout: " << timeout_in_seconds);
request_controller_->UpdateTimer();
} else {
LOG4CXX_INFO(logger_, "Default timeout was set to 0."
"RequestController will not track timeout of this request.");
}
- request_controller_->pending_request_set_lock_.Release();
+
AutoUnlock unlock(auto_lock);
// execute
- if (request->CheckPermissions() && init_res) {
+ if ((false == request_controller_->IsLowVoltage()) &&
+ request->CheckPermissions() && init_res) {
request->Run();
}
}
-
}
-bool RequestController::Worker::exitThreadMain() {
+void RequestController::Worker::exitThreadMain() {
stop_flag_ = true;
- sync_primitives::AutoLock auto_lock(thread_lock_);
// setup stop flag and whit while threadMain will be finished correctly
- // FIXME (dchmerev@luxoft.com): There is no wating
- return true;
-}
-
-bool RequestController::checkTimeScaleMaxRequest(
- const uint32_t& app_id,
- const uint32_t& app_time_scale,
- const uint32_t& max_request_per_time_scale) {
- LOG4CXX_TRACE_ENTER(logger_);
- {
- AutoLock auto_lock(pending_request_set_lock_);
- TimevalStruct end = date_time::DateTime::getCurrentTime();
- TimevalStruct start;
- start.tv_sec = end.tv_sec - app_time_scale;
-
- TimeScale scale(start, end, app_id);
- uint32_t count = 0;
-
- count = count_if (pending_request_set_.begin(), pending_request_set_.end(), scale);
- if (count == max_request_per_time_scale ) {
- LOG4CXX_ERROR(logger_, "Requests count " << count <<
- " exceed application limit " << max_request_per_time_scale);
- return true;
- }
- }
- return true;
-}
-
-bool RequestController::checkHMILevelTimeScaleMaxRequest(
- const mobile_apis::HMILevel::eType& hmi_level,
- const uint32_t& app_id,
- const uint32_t& app_time_scale,
- const uint32_t& max_request_per_time_scale) {
- LOG4CXX_TRACE_ENTER(logger_);
- {
- AutoLock auto_lock(pending_request_set_lock_);
- TimevalStruct end = date_time::DateTime::getCurrentTime();
- TimevalStruct start;
- start.tv_sec = end.tv_sec - app_time_scale;
-
- HMILevelTimeScale scale(start, end, app_id, hmi_level);
- uint32_t count = 0;
-
- count = count_if (pending_request_set_.begin(), pending_request_set_.end(), scale);
- if (count == max_request_per_time_scale ) {
- LOG4CXX_ERROR(logger_, "Requests count " << count
- << " exceed application limit " << max_request_per_time_scale
- << " in hmi level " << hmi_level);
- return false;
- }
- }
- return true;
+ // FIXME (dchmerev@luxoft.com): There is no waiting
}
void RequestController::UpdateTimer() {
- LOG4CXX_TRACE_ENTER(logger_);
- uint32_t sleep_time = dafault_sleep_time_;
- RequestInfoSet::iterator it = pending_request_set_.begin();
-
- while (it != pending_request_set_.end()) {
- RequestInfoPtr request = *it;
- DCHECK(request.valid());
- if (0 == request->timeout_sec()) {
- ++it;
- // This request should not be observed for TIME_OUT
- continue;
+ LOG4CXX_AUTO_TRACE(logger_);
+ RequestInfoPtr front = waiting_for_response_.FrontWithNotNullTimeout();
+ if (front) {
+ const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const TimevalStruct end_time = front->end_time();
+ if (current_time < end_time) {
+ const uint64_t secs = end_time.tv_sec - current_time.tv_sec;
+ LOG4CXX_DEBUG(logger_, "Sleep for " << secs << " secs");
+ // Timeout for bigger than 5 minutes is a mistake
+ timer_.updateTimeOut(secs);
+ } 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);
}
- sleep_time = request->end_time().tv_sec -
- date_time::DateTime::getCurrentTime().tv_sec;
- break;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Sleep for default sleep time "
+ << dafault_sleep_time_ << " secs");
+ timer_.updateTimeOut(dafault_sleep_time_);
}
- timer_.updateTimeOut(sleep_time);
- LOG4CXX_INFO(logger_, "Sleep for: " << sleep_time);
- LOG4CXX_TRACE_EXIT(logger_);
}
-
} // namespace request_controller
-
} // namespace application_manager
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index 0b448c9e47..dad1539b64 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -1,4 +1,4 @@
-/**
+/*
* \file request_info.h
* \brief request information structure source file.
*
@@ -29,38 +29,43 @@
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ 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 <algorithm>
namespace application_manager {
namespace request_controller {
+CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController");
+
+uint32_t RequestInfo::HmiConnectoinKey = 0;
+
HMIRequestInfo::HMIRequestInfo(
RequestPtr request,
const uint64_t timeout_sec):
- RequestInfo(timeout_sec),
- request_(request) {
+ RequestInfo(request, HMIRequest, timeout_sec) {
correlation_id_ = request_->correlation_id();
+ app_id_ = RequestInfo::HmiConnectoinKey;
}
HMIRequestInfo::HMIRequestInfo(
RequestPtr request,
const TimevalStruct &start_time,
const uint64_t timeout_sec):
- RequestInfo(start_time, timeout_sec),
- request_(request) {
+ RequestInfo(request, HMIRequest, start_time, timeout_sec) {
correlation_id_ = request_->correlation_id();
+ app_id_ = RequestInfo::HmiConnectoinKey;
}
MobileRequestInfo::MobileRequestInfo(
RequestPtr request,
const uint64_t timeout_sec):
- RequestInfo(timeout_sec),
- request_(request) {
- mobile_correlation_id_ = request_.get()->correlation_id();
+ RequestInfo(request, MobileRequest, timeout_sec) {
+ correlation_id_ = request_.get()->correlation_id();
app_id_ = request_.get()->connection_key();
}
@@ -68,12 +73,301 @@ MobileRequestInfo::MobileRequestInfo(
RequestPtr request,
const TimevalStruct &start_time,
const uint64_t timeout_sec):
- RequestInfo(start_time, timeout_sec),
- request_(request) {
- mobile_correlation_id_ = request_.get()->correlation_id();
+ RequestInfo(request, MobileRequest, start_time, timeout_sec) {
+ correlation_id_ = request_.get()->correlation_id();
app_id_ = request_.get()->connection_key();
}
-} // namespace request_controller
+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) {
+ updateEndTime();
+ requst_type_ = requst_type;
+ correlation_id_ = request_->correlation_id();
+ app_id_ = request_->connection_key();
+}
+
+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;
+}
+
+void RequestInfo::updateTimeOut(const uint64_t& timeout_sec) {
+ timeout_sec_ = timeout_sec;
+ 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);
+}
+
+uint64_t RequestInfo::hash() {
+ return GenerateHash(app_id(), requestId());
+}
+
+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;
+ return hash_result;
+}
+
+FakeRequestInfo::FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id) {
+ app_id_ = app_id;
+ correlation_id_ = correaltion_id;
+}
+
+bool RequestInfoSet::Add(RequestInfoPtr request_info) {
+ DCHECK(request_info);
+ if (!request_info) {
+ LOG4CXX_ERROR(logger_, "NULL ponter request_info");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Add request app_id = " << request_info->app_id()
+ << "; corr_id = " << request_info->requestId());
+ CheckSetSizes();
+ sync_primitives::AutoLock lock(this_lock_);
+ const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt =
+ hash_sorted_pending_requests_.insert(request_info);
+ if (insert_resilt.second == true) {
+ const std::pair<TimeSortedRequestInfoSet::iterator, bool>& insert_resilt =
+ time_sorted_pending_requests_.insert(request_info);
+ DCHECK(insert_resilt.second);
+ if (!insert_resilt.second) {
+ return false;
+ }
+ CheckSetSizes();
+ return true;
+ } else {
+ LOG4CXX_ERROR(logger_, "Request with app_id = " << request_info->app_id()
+ << "; corr_id " << request_info->requestId() << " Already exist ");
+ }
+ CheckSetSizes();
+ return false;
+}
+
+RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key,
+ const uint32_t correlation_id) {
+ RequestInfoPtr result;
+
+ // Request info for searching in request info set by log_n time
+ utils::SharedPtr<FakeRequestInfo> request_info_for_search(
+ new FakeRequestInfo(connection_key, correlation_id));
+
+ sync_primitives::AutoLock lock(this_lock_);
+ HashSortedRequestInfoSet::iterator it =
+ hash_sorted_pending_requests_.find(request_info_for_search);
+ if (it != hash_sorted_pending_requests_.end()) {
+ result = *it;
+ }
+ return result;
+}
+
+RequestInfoPtr RequestInfoSet::Front() {
+ RequestInfoPtr result;
+
+ sync_primitives::AutoLock lock(this_lock_);
+ TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
+ if (it != time_sorted_pending_requests_.end()) {
+ result = *it;
+ }
+ return result;
+}
+
+RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(this_lock_);
+ RequestInfoPtr result;
+ TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
+ while (it != time_sorted_pending_requests_.end()) {
+ if (0 != (*it)->timeout_sec()) {
+ result =*it;
+ it = time_sorted_pending_requests_.end();
+ } else {
+ ++it;
+ }
+ }
+ return result;
+}
+
+bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
+ DCHECK(request_info);
+ if (!request_info) {
+ LOG4CXX_ERROR(logger_, "NULL ponter request_info");
+ return false;
+ }
+ CheckSetSizes();
+
+ size_t erased_count =
+ hash_sorted_pending_requests_.erase(request_info);
+ DCHECK((erased_count <= 1));
+ if (1 == erased_count) {
+ TimeSortedRequestInfoSet::iterator it =
+ time_sorted_pending_requests_.find(request_info);
+ DCHECK(it != time_sorted_pending_requests_.end());
+ if (it == time_sorted_pending_requests_.end()) {
+ LOG4CXX_ERROR(logger_, "Can't find request in time_sorted_requests_");
+ return false;
+ }
+ const RequestInfoPtr found = *it;
+ DCHECK(request_info == found);
+ time_sorted_pending_requests_.erase(it);
+ CheckSetSizes();
+ return 1 == erased_count;
+ }
+ CheckSetSizes();
+ return false;
+}
+
+bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) {
+ sync_primitives::AutoLock lock(this_lock_);
+ return Erase(request_info);
+}
+
+
+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 to_erase = it++;
+ Erase(*to_erase);
+ it = std::find_if(it, hash_sorted_pending_requests_.end(), filter);
+ erased++;
+ }
+ CheckSetSizes();
+ return erased;
+}
+
+
+uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return RemoveRequests(AppIdCompararator(AppIdCompararator::Equal, connection_key));
+}
+
+uint32_t RequestInfoSet::RemoveMobileRequests() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, RequestInfo::HmiConnectoinKey));
+}
+
+const size_t RequestInfoSet::Size() {
+ CheckSetSizes();
+ return time_sorted_pending_requests_.size();
+}
+
+void RequestInfoSet::CheckSetSizes() {
+ const ssize_t time_set_size = time_sorted_pending_requests_.size();
+ const ssize_t hash_set_size = hash_sorted_pending_requests_.size();
+ const bool set_sizes_equal = (time_set_size == hash_set_size);
+ DCHECK(set_sizes_equal);
+}
+
+bool RequestInfoSet::CheckTimeScaleMaxRequest(
+ 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) {
+ TimevalStruct end = date_time::DateTime::getCurrentTime();
+ TimevalStruct start = {0, 0};
+ start.tv_sec = end.tv_sec - app_time_scale;
+
+ 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);
+ if (count >= 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);
+ } else {
+ LOG4CXX_DEBUG(logger_, "CheckTimeScaleMaxRequest disabled");
+ }
+ return true;
+}
+
+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) {
+ TimevalStruct end = date_time::DateTime::getCurrentTime();
+ TimevalStruct start = {0, 0};
+ start.tv_sec = end.tv_sec - app_time_scale;
+
+ 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);
+ 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);
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Requests count " << count);
+ } else {
+ LOG4CXX_DEBUG(logger_, "CheckHMILevelTimeScaleMaxRequest disabled");
+ }
+ return true;
+}
+
+bool RequestInfoSet::AppIdCompararator::operator()(const RequestInfoPtr value_compare) const {
+ switch (compare_type_) {
+ case Equal:
+ return value_compare->app_id() == app_id_;
+ case NotEqual:
+ return value_compare->app_id() != app_id_;
+ default:
+ return false;
+ }
+}
+
+bool RequestInfoTimeComparator::operator()(const RequestInfoPtr lhs,
+ const RequestInfoPtr rhs) const {
+ date_time::TimeCompare compare_result =
+ date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time());
+ if (compare_result == date_time::LESS) {
+ return true;
+ } else if (compare_result == date_time::GREATER) {
+ return false;
+ }
+ // compare_result == date_time::EQUAL
+ // If time is equal, sort by hash
+ LOG4CXX_DEBUG(logger_, "EQUAL " << lhs->end_time().tv_sec << ":" << lhs->end_time().tv_usec
+ << " and " << rhs->end_time().tv_sec << ":" << rhs->end_time().tv_usec
+ << "; compare hash: " << lhs->hash() << " < " << rhs->hash()
+ << " = " << (lhs->hash() < rhs->hash()));
+ return lhs->hash() < rhs->hash();
+}
+
+bool RequestInfoHashComparator::operator()(const RequestInfoPtr lhs,
+ const RequestInfoPtr rhs) const {
+ return lhs->hash() < rhs->hash();
+}
+
+} // namespace request_controller
-} // namespace application_manager
+} // namespace application_manager
diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp
index cdbd6dc1cf..f8dd1b589f 100644
--- a/src/components/application_manager/src/resume_ctrl.cpp
+++ b/src/components/application_manager/src/resume_ctrl.cpp
@@ -1,6 +1,39 @@
-#include <fstream>
-
+/*
+ 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"
@@ -22,103 +55,103 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ResumeCtrl")
namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
ResumeCtrl::ResumeCtrl(ApplicationManagerImpl* app_mngr)
- : app_mngr_(app_mngr),
- timer_("ResumeCtrl", this, &ResumeCtrl::onTimer) {
+ : 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_INFO(logger_, "ResumeCtrl::SaveApplications()");
- DCHECK(app_mngr_);
-
- std::set<ApplicationSharedPtr>::iterator it =
- app_mngr_->application_list_.begin();
- std::set<ApplicationSharedPtr>::iterator it_end =
- app_mngr_->application_list_.end();
- for (; it != it_end; ++it) {
- SaveApplication(*it);
- }
+ 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) {
- LOG4CXX_INFO(logger_, "ResumeCtrl::SaveApplication");
-
DCHECK(application.get());
- Json::Value* json_app = NULL;
-
- const std::string& m_app_id = application->mobile_app_id()->asString();
- Json::Value::iterator it = GetSavedApplications().begin();
- for (; it != GetSavedApplications().end(); ++it) {
- if (m_app_id == (*it)[strings::app_id].asString()) {
- json_app = &(*it);
- LOG4CXX_INFO(logger_, "ResumeCtrl Application with this id "
- "already exist ( update info )."
- "mobile app_id = " << m_app_id);
- break;
- }
- }
-
- if (json_app == NULL) {
- LOG4CXX_INFO(logger_, "ResumeCtrl Application with this ID does not"
- "exist. Add new. mobile app_id = " << m_app_id);
- json_app = &(GetSavedApplications().append(Json::Value()));
+ if (!application) {
+ LOG4CXX_FATAL(logger_, "Application object is NULL.");
+ return;
}
- uint32_t hash = application->curHash();
- uint32_t grammar_id = application->get_grammar_id();
-
- LOG4CXX_INFO(logger_, "Hash = " << hash);
- (*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::hmi_level] =
- static_cast<int32_t> (application->hmi_level());
- (*json_app)[strings::ign_off_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] = (uint32_t)time(NULL);
- (*json_app)[strings::audio_streaming_state] = application->audio_streaming_state();
+ 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_INFO(logger_, "ResumeCtrl::on_event ");
+ LOG4CXX_TRACE(logger_, "Response from HMI command");
}
-bool ResumeCtrl::RestoreApplicationHMILevel(ApplicationSharedPtr application) {
- if (false == application.valid()) {
+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;
}
- Json::Value::iterator it = GetSavedApplications().begin();
- for (;it != GetSavedApplications().end(); ++it) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
-
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
-
- mobile_apis::HMILevel::eType saved_hmi_level;
- //mobile_apis::HMILevel::eType restored_hmi_level;
-
- mobile_apis::AudioStreamingState::eType audio_streaming_state =
- static_cast<mobile_apis::AudioStreamingState::eType>
- ((*it)[strings::audio_streaming_state].asInt());
- application->set_audio_streaming_state(audio_streaming_state);
- saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>(
- (*it)[strings::hmi_level].asInt());
-
- return SetupHMILevel(application, saved_hmi_level, audio_streaming_state);
+ 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");
@@ -126,52 +159,28 @@ bool ResumeCtrl::RestoreApplicationHMILevel(ApplicationSharedPtr application) {
}
bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
- LOG4CXX_TRACE_ENTER(logger_);
if (false == application.valid()) {
LOG4CXX_ERROR(logger_, "SetupDefaultHMILevel application pointer is invalid");
return false;
}
-
- mobile_apis::HMILevel::eType default_hmi = mobile_apis::HMILevel::HMI_NONE;
-
- if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- std::string policy_app_id = application->mobile_app_id()->asString();
- std::string default_hmi_string = "";
- bool result_get_hmi = policy::PolicyHandler::instance()->GetDefaultHmi(
- policy_app_id, &default_hmi_string);
- if (true == result_get_hmi) {
- if ("BACKGROUND" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- LOG4CXX_ERROR(logger_, "Unable to convert " + default_hmi_string + "to HMILevel");
- return false;
- }
- } else {
- LOG4CXX_ERROR(logger_, "SetupDefaultHMILevel() unable to get default hmi_level for "
- << policy_app_id);
- }
- }
-
- return SetupHMILevel(application, default_hmi,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE, false);
+ LOG4CXX_TRACE(logger_, "ENTER app_id : " << application->app_id());
+ mobile_apis::HMILevel::eType default_hmi = ApplicationManagerImpl::instance()-> GetDefaultHmiLevel(application);
+ bool result = SetAppHMIState(application, default_hmi, false);
+ return result;
}
-bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_streaming_state,
+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_, "SetupHMILevel() application pointer in invalid");
+ LOG4CXX_ERROR(logger_, "Application pointer in invalid");
return false;
}
-
+ LOG4CXX_TRACE(logger_, " ENTER Params : ( " << application->app_id()
+ << "," << hmi_level
+ << "," << check_policy << " )");
const std::string device_id =
MessageHelper::GetDeviceMacAddressForHandle(application->device());
@@ -182,336 +191,176 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application,
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_WARN(logger_, "Hmi level " << hmi_level << " should not be set to "
- << application->mobile_app_id()->asString() << " " << application->hmi_level());
-
+ 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 (mobile_apis::HMILevel::HMI_FULL == hmi_level) {
- hmi_level = app_mngr_->PutApplicationInFull(application);
-
- if ((mobile_apis::HMILevel::HMI_FULL == hmi_level ||
- mobile_apis::HMILevel::HMI_LIMITED == hmi_level) &&
- (mobile_apis::AudioStreamingState::AUDIBLE == audio_streaming_state)) {
- application->set_audio_streaming_state(audio_streaming_state);
- }
- } else if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) {
- if ((false == application->IsAudioApplication()) ||
- app_mngr_->DoesAudioAppWithSameHMITypeExistInFullOrLimited(application)) {
- hmi_level = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else {
- if (audio_streaming_state == mobile_apis::AudioStreamingState::AUDIBLE) {
- //implemented SDLAQ-CRS-839
- //checking the existence of application with AudioStreamingState=AUDIBLE
- //notification resumeAudioSource is sent if only resumed application has
- //AudioStreamingState=AUDIBLE
- bool application_exist_with_audible_state = false;
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- const std::set<ApplicationSharedPtr> app_list = accessor.applications();
- std::set<ApplicationSharedPtr>::const_iterator app_list_it = app_list
- .begin();
- uint32_t app_id = application->app_id();
- for (; app_list.end() != app_list_it; ++app_list_it) {
- if ((mobile_apis::AudioStreamingState::AUDIBLE ==
- (*app_list_it)->audio_streaming_state())
- && ((*app_list_it))->app_id() != app_id) {
- application_exist_with_audible_state = true;
- break;
- }
- }
- if (application_exist_with_audible_state) {
- application->set_audio_streaming_state(
- mobile_apis::AudioStreamingState::NOT_AUDIBLE);
- } else {
- MessageHelper::SendOnResumeAudioSourceToHMI(application->app_id());
+ if (HMILevel::HMI_FULL == hmi_level) {
+ restored_hmi_level = app_mngr_->IsHmiLevelFullAllowed(application);
+ } else if (HMILevel::HMI_LIMITED == hmi_level) {
+ bool allowed_limited = true;
+ 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 (hmi_level != mobile_apis::HMILevel::HMI_FULL) {
- application->set_hmi_level(hmi_level);
- }
+ const AudioStreamingState::eType restored_audio_state =
+ HMILevel::HMI_FULL == restored_hmi_level ||
+ HMILevel::HMI_LIMITED == restored_hmi_level ? AudioStreamingState::AUDIBLE:
+ AudioStreamingState::NOT_AUDIBLE;
- MessageHelper::SendHMIStatusNotification(*(application.get()));
+ application->set_audio_streaming_state(restored_audio_state);
+ if (HMILevel::HMI_FULL == restored_hmi_level) {
+ MessageHelper::SendActivateAppToHMI(application->app_id());
+ } else {
+ if (HMILevel::HMI_LIMITED == restored_hmi_level) {
+ MessageHelper::SendOnResumeAudioSourceToHMI(application->app_id());
+ }
+ application->set_hmi_level(restored_hmi_level);
+ MessageHelper::SendHMIStatusNotification(*(application.get()));
+ }
LOG4CXX_INFO(logger_, "Set up application "
- << application->mobile_app_id()->asString()
+ << application->mobile_app_id()
<< " to HMILevel " << hmi_level);
return true;
}
bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) {
- LOG4CXX_INFO(logger_, "RestoreApplicationData");
- DCHECK(application.get());
-
- Json::Value::iterator it = GetSavedApplications().begin();
- for (; it != GetSavedApplications().end(); ++it) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
- break;
- }
- }
-
- if (it == GetSavedApplications().end()) {
- LOG4CXX_WARN(logger_, "Application not saved");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!application.valid()) {
+ LOG4CXX_ERROR(logger_, "Application pointer in invalid");
return false;
}
- Json::Value& saved_app = *it;
- MessageHelper::SmartObjectList requests;
-
- LOG4CXX_INFO(logger_, saved_app.toStyledString());
- Json::Value& app_commands = saved_app[strings::application_commands];
- Json::Value& app_submenus = saved_app[strings::application_submenus];
- Json::Value& app_choise_sets = saved_app[strings::application_choise_sets];
- Json::Value& global_properties = saved_app[strings::application_global_properties];
- Json::Value& subscribtions = saved_app[strings::application_subscribtions];
- Json::Value& application_files = saved_app[strings::application_files];
- uint32_t app_grammar_id = saved_app[strings::grammar_id].asUInt();
- application->set_grammar_id(app_grammar_id);
-
-
- // files
- for (Json::Value::iterator json_it = application_files.begin();
- json_it != application_files.end(); ++json_it) {
- Json::Value& file_data = *json_it;
-
- bool is_persistent = 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());
- LOG4CXX_INFO(logger_, "RestoreApplicationData file " << file.file_name);
- application->AddFile(file);
- }
- }
-
- //add submenus
- for (Json::Value::iterator json_it = app_submenus.begin();
- json_it != app_submenus.end(); ++json_it) {
- Json::Value& json_submenu = *json_it;
- smart_objects::SmartObject message = smart_objects::SmartObject(
- smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_submenu, message);
- application->AddSubMenu(message[strings::menu_id].asUInt(), message);
- }
- requests = MessageHelper::CreateAddSubMenuRequestToHMI(application);
-
- for (MessageHelper::SmartObjectList::iterator it = requests.begin();
- it != requests.end(); ++it) {
- ProcessHMIRequest(*it, true);
- }
-
- //add commands
- for (Json::Value::iterator json_it = app_commands.begin();
- json_it != app_commands.end(); ++json_it) {
- Json::Value& json_command = *json_it;
- smart_objects::SmartObject message = smart_objects::SmartObject(
- smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_command, message);
- application->AddCommand(message[strings::cmd_id].asUInt(), message);
- }
-
- requests = MessageHelper::CreateAddCommandRequestToHMI(application);
-
- for (MessageHelper::SmartObjectList::iterator it = requests.begin();
- it != requests.end(); ++it) {
- ProcessHMIRequest(*it, true);
- }
-
- //add choisets
- for (Json::Value::iterator json_it = app_choise_sets.begin();
- json_it != app_choise_sets.end(); ++json_it) {
- Json::Value& json_choiset = *json_it;
- smart_objects::SmartObject msg_param = smart_objects::SmartObject(
- 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);
-
- for (size_t j = 0; j < msg_param[strings::choice_set].length(); ++j) {
- smart_objects::SmartObject choise_params = smart_objects::SmartObject(
- 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);
- }
- }
-
- //setglobal properties
- if (!global_properties.isNull()) {
- smart_objects::SmartObject properties_so = smart_objects::SmartObject(
- smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(global_properties , properties_so);
-
- const smart_objects::SmartObject& vr_help_title =
- properties_so.getElement(strings::vr_help_title);
- if (vr_help_title.getType() != smart_objects::SmartType::SmartType_Invalid &&
- vr_help_title.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_vr_help_title(vr_help_title);
- }
-
- const smart_objects::SmartObject& vr_help =
- properties_so.getElement(strings::vr_help);
- if (vr_help.getType() != smart_objects::SmartType::SmartType_Invalid &&
- vr_help.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_vr_help(vr_help);
- }
-
- const smart_objects::SmartObject& timeout_prompt =
- properties_so.getElement(strings::timeout_prompt);
- if (timeout_prompt.getType() != smart_objects::SmartType::SmartType_Invalid &&
- timeout_prompt.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_timeout_prompt(timeout_prompt);
- }
+ LOG4CXX_DEBUG(logger_, "ENTER app_id : " << application->app_id());
- const smart_objects::SmartObject& help_prompt =
- properties_so.getElement(strings::help_prompt);
- if (help_prompt.getType() != smart_objects::SmartType::SmartType_Invalid &&
- help_prompt.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_help_prompt(help_prompt);
- }
-
- const smart_objects::SmartObject& keyboard_properties =
- properties_so.getElement(strings::keyboard_properties);
- if (keyboard_properties.getType() != smart_objects::SmartType::SmartType_Invalid &&
- keyboard_properties.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_keyboard_props(keyboard_properties);
- }
-
- const smart_objects::SmartObject& menu_title =
- properties_so.getElement(strings::menu_title);
- if (menu_title.getType() != smart_objects::SmartType::SmartType_Invalid &&
- menu_title.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_menu_title(menu_title);
- }
-
- const smart_objects::SmartObject& menu_icon =
- properties_so.getElement(strings::menu_icon);
- if (menu_icon.getType() != smart_objects::SmartType::SmartType_Invalid &&
- menu_icon.getType() != smart_objects::SmartType::SmartType_Null) {
- application->set_menu_icon(menu_icon);
- }
-
- MessageHelper::SendGlobalPropertiesToHMI(application);
+ 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;
}
- //subscribes
- if (!subscribtions.isNull()) {
- Json::Value& subscribtions_buttons = subscribtions[strings::application_buttons];
- Json::Value& subscribtions_ivi= subscribtions[strings::application_vehicle_info];
- for (Json::Value::iterator json_it = subscribtions_buttons.begin();
- json_it != subscribtions_buttons.end(); ++json_it) {
- mobile_apis::ButtonName::eType btn;
- btn = static_cast<mobile_apis::ButtonName::eType>((*json_it).asInt());
- application->SubscribeToButton(btn);
- }
-
- for (Json::Value::iterator json_it = subscribtions_ivi.begin();
- json_it != subscribtions_ivi.end(); ++json_it) {
- VehicleDataType ivi;
- ivi = static_cast<VehicleDataType>((*json_it).asInt());
- LOG4CXX_INFO(logger_, "VehicleDataType :" << ivi);
-#ifdef ENABLE_LOG
- bool result =
-#endif
- application->SubscribeToIVI(ivi);
- LOG4CXX_INFO(logger_, "result = :" << result);
- }
- requests = MessageHelper::GetIVISubscribtionRequests(application->app_id());
-
- for (MessageHelper::SmartObjectList::iterator it = requests.begin();
- it != requests.end(); ++it) {
- ProcessHMIRequest(*it,true);
- }
+ 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_INFO(logger_, "ResumeCtrl::IsHMIApplicationIdExist " << 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)[strings::hmi_app_id].asUInt() == hmi_app_id) {
- return true;
+ 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();
- std::set<ApplicationSharedPtr>::iterator it =
- app_mngr_->application_list_.begin();
- std::set<ApplicationSharedPtr>::iterator it_end =
- app_mngr_->application_list_.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) {
- bool result = false;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it)[strings::app_id].asString() == mobile_app_id) {
- result = true;
- }
+ 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;
}
- LOG4CXX_INFO(logger_, "IsApplicationSaved " << mobile_app_id << " : " << (result?"true":"false"));
- return result;
+
+ 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;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it)[strings::app_id].asString() == mobile_app_id) {
- hmi_app_id = (*it)[strings::hmi_app_id].asUInt();
- }
+
+ 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(ApplicationConstSharedPtr application) {
- LOG4CXX_INFO(logger_, "ResumeCtrl::RemoveApplicationFromSaved ");
- DCHECK(application.get());
-
+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) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
+ if ((*it).isMember(strings::app_id)) {
+ const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
- if (saved_m_app_id != application->mobile_app_id()->asString()) {
- temp.push_back((*it));
- } else {
- result = true;
+ 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;
}
@@ -520,267 +369,395 @@ bool ResumeCtrl::RemoveApplicationFromSaved(ApplicationConstSharedPtr applicatio
it != temp.end(); ++it) {
GetSavedApplications().append((*it));
}
+ LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
return result;
}
-void ResumeCtrl::IgnitionOff() {
- LOG4CXX_INFO(logger_, "ResumeCtrl::IgnitionOff()");
-
+void ResumeCtrl::Suspend() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopSavePersistentDataTimer();
+ SaveAllApplications();
Json::Value to_save;
+ sync_primitives::AutoLock lock(resumtion_lock_);
for (Json::Value::iterator it = GetSavedApplications().begin();
it != GetSavedApplications().end(); ++it) {
- uint32_t ign_off_count = (*it)[strings::ign_off_count].asUInt();
- if (ign_off_count < kApplicationLifes) {
- ign_off_count++;
- (*it)[strings::ign_off_count] = ign_off_count;
- to_save.append(*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();
+ }
+}
+
+
bool ResumeCtrl::StartResumption(ApplicationSharedPtr application,
- uint32_t hash) {
- LOG4CXX_INFO(logger_, "ResumeCtrl::StartResumption");
- if (!application.valid()) {
+ const std::string& hash) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!application) {
LOG4CXX_WARN(logger_, "Application not exist");
return false;
}
- LOG4CXX_INFO(logger_, " app_id = " << application->app_id()
+ SetupDefaultHMILevel(application);
+
+ LOG4CXX_DEBUG(logger_, " Resume app_id = " << application->app_id()
<< " hmi_app_id = " << application->hmi_app_id()
- << " mobile_id = "
- << application->mobile_app_id()->asString());
+ << " mobile_id = " << application->mobile_app_id()
+ << "received hash = " << hash);
- Json::Value::iterator it = GetSavedApplications().begin();
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- for (; it != GetSavedApplications().end(); ++it) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
+ 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;
+ }
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
+ 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();
- uint32_t saved_hash = (*it)[strings::hash_id].asUInt();
- uint32_t time_stamp= (*it)[strings::time_stamp].asUInt();
+ 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;
+ }
- if (hash == saved_hash) {
- RestoreApplicationData(application);
- }
+ return true;
+}
- application->UpdateHash();
- if (!timer_.isRunning() && accessor.applications().size() > 1) {
- RestoreApplicationHMILevel(application);
- RemoveApplicationFromSaved(application);
- } else {
- sync_primitives::AutoLock auto_lock(queue_lock_);
- SetupDefaultHMILevel(application);
- waiting_for_timer_.insert(std::make_pair(application->app_id(),
- time_stamp));
- timer_.start(kTimeStep);
- }
- 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());
}
}
+}
- LOG4CXX_INFO(logger_, "ResumeCtrl::Application wasn't saved");
- MessageHelper::SendHMIStatusNotification(*application);
- return false;
+std::set<ApplicationSharedPtr> ResumeCtrl::retrieve_application() {
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ return std::set<ApplicationSharedPtr>(accessor.begin(), accessor.end());
}
bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) {
- LOG4CXX_INFO(logger_, "ResumeCtrl::StartResumptionOnlyHMILevel");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!application.valid()) {
- LOG4CXX_WARN(logger_, "Application not exist");
+ LOG4CXX_WARN(logger_, "Application do not exists");
return false;
}
- LOG4CXX_INFO(logger_, "app_id = " << application->app_id()
+ SetupDefaultHMILevel(application);
+
+ LOG4CXX_DEBUG(logger_, "ENTER app_id = " << application->app_id()
<< "mobile_id = "
- << application->mobile_app_id()->asString());
+ << application->mobile_app_id());
- Json::Value::iterator it = GetSavedApplications().begin();
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- for (; it != GetSavedApplications().end(); ++it) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
- uint32_t time_stamp= (*it)[strings::time_stamp].asUInt();
- if (!timer_.isRunning() && accessor.applications().size() > 1) {
- // resume in case there is already registered app
- RestoreApplicationHMILevel(application);
- RemoveApplicationFromSaved(application);
- } else {
- sync_primitives::AutoLock auto_lock(queue_lock_);
- SetupDefaultHMILevel(application);
- waiting_for_timer_.insert(std::make_pair(application->app_id(),
- time_stamp));
- // woun't start timer if it is active already
- timer_.start(kTimeStep);
- }
- return true;
- }
+ 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;
}
- LOG4CXX_INFO(logger_, "ResumeCtrl::Application wasn't saved");
- MessageHelper::SendHMIStatusNotification(*application);
- 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_INFO(logger_, "CheckPersistenceFilesForResumption");
- DCHECK(application.get());
+ LOG4CXX_AUTO_TRACE(logger_);
- Json::Value::iterator it = GetSavedApplications().begin();
- for (; it != GetSavedApplications().end(); ++it) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
-
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
- break;
- }
+ if (!application.valid()) {
+ LOG4CXX_WARN(logger_, "Application do not exists");
+ return false;
}
+ LOG4CXX_DEBUG(logger_, "Process app_id = " << application->app_id());
- if (it == GetSavedApplications().end()) {
+ 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;
}
- Json::Value& saved_app = *it;
- MessageHelper::SmartObjectList requests;
-
- LOG4CXX_INFO(logger_, saved_app.toStyledString());
- Json::Value& app_commands = saved_app[strings::application_commands];
- Json::Value& app_choise_sets = saved_app[strings::application_choise_sets];
-
- //add commands
- for (Json::Value::iterator json_it = app_commands.begin();
- json_it != app_commands.end(); ++json_it) {
- Json::Value& json_command = *json_it;
- smart_objects::SmartObject message =
- smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_command, message);
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyImageFiles(message, application);
- if (verification_result == mobile_apis::Result::INVALID_DATA) {
- LOG4CXX_WARN(logger_, "app_commands missed icons");
+ 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;
}
- }
- //add choice sets
- for (Json::Value::iterator json_it = app_choise_sets.begin();
- json_it != app_choise_sets.end(); ++json_it) {
- Json::Value& json_choiset = *json_it;
- smart_objects::SmartObject msg_param =
- smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_choiset , msg_param);
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyImageFiles(msg_param, application);
- if (verification_result == mobile_apis::Result::INVALID_DATA) {
- LOG4CXX_WARN(logger_, "app_choise_sets missed icons");
+ 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,
- uint32_t hash) {
- Json::Value::iterator it = GetSavedApplications().begin();
- for (; it != GetSavedApplications().end(); ++it) {
- std::string saved_m_app_id = (*it)[strings::app_id].asString();
-
- if (saved_m_app_id == application->mobile_app_id()->asString()) {
- uint32_t saved_hash = (*it)[strings::hash_id].asUInt();
- LOG4CXX_INFO(logger_, "received hash = " << hash);
- LOG4CXX_INFO(logger_, "saved hash = " << saved_hash);
- if (hash == saved_hash) {
- return true;
- }
- }
+ const std::string& hash) {
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application pointer is invalid");
+ return false;
}
- return false;
-}
+ LOG4CXX_DEBUG(logger_, "ENTER app_id : " << application->app_id()
+ << " hash : " << hash);
-void ResumeCtrl::onTimer() {
- LOG4CXX_INFO(logger_, "ResumeCtrl::onTimer() size is "
- << waiting_for_timer_.size());
- sync_primitives::AutoLock auto_lock(queue_lock_);
+ 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;
+ }
- std::multiset<application_timestamp, TimeStampComparator>::iterator it=
- waiting_for_timer_.begin();
+ const Json::Value& json_app = GetSavedApplications()[idx];
- for (; it != waiting_for_timer_.end(); ++it) {
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application((*it).first);
- if (!app.get()) {
- LOG4CXX_ERROR(logger_, "Invalid app_id = " << (*it).first);
- continue;
+ 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;
+}
- RestoreApplicationHMILevel(app);
- RemoveApplicationFromSaved(app);
+void ResumeCtrl::SaveDataOnTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_resumption_active_) {
+ LOG4CXX_WARN(logger_, "Resumption timer is active skip saving");
+ return;
}
- waiting_for_timer_.clear();
+ 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() {
- return resumption::LastState::instance()->dictionary[strings::resumption];
+ 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) {
- resumption::LastState::instance()->dictionary[strings::resumption] = apps_json ;
+ Json::Value& app_list = GetSavedApplications();
+ app_list = apps_json;
}
void ResumeCtrl::ClearResumptionInfo() {
- Json::Value empty_json;
+ LOG4CXX_AUTO_TRACE(logger_);
+ Json::Value empty_json;
- SetSavedApplication(empty_json);
- resumption::LastState::instance()->SaveToFileSystem();
+ SetSavedApplication(empty_json);
+ resumption::LastState::instance()->SaveToFileSystem();
}
Json::Value ResumeCtrl::GetApplicationCommands(
ApplicationConstSharedPtr application) {
- DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationCommands "
- << application->app_id());
-
+ LOG4CXX_AUTO_TRACE(logger_);
Json::Value result;
- const CommandsMap& commands = application->commands_map();
+ 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);
- LOG4CXX_INFO(logger_, "Converted:" << curr.toStyledString());
}
return result;
}
Json::Value ResumeCtrl::GetApplicationSubMenus(
ApplicationConstSharedPtr application) {
- DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationCommands "
- << application->app_id());
-
+ LOG4CXX_AUTO_TRACE(logger_);
Json::Value result;
- const SubMenuMap& sub_menus = application->sub_menu_map();
+ 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);
- LOG4CXX_INFO(logger_, "Converted:" << curr.toStyledString());
}
return result;
}
@@ -788,29 +765,32 @@ Json::Value ResumeCtrl::GetApplicationSubMenus(
Json::Value ResumeCtrl::GetApplicationInteractionChoiseSets(
ApplicationConstSharedPtr application) {
DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationInteractionChoiseSets "
+ LOG4CXX_TRACE(logger_, "ENTER app_id:"
<< application->app_id());
Json::Value result;
- const ChoiceSetMap& choices = application->choice_set_map();
+ 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);
- LOG4CXX_INFO(logger_, "Converted:" << curr.toStyledString());
}
return result;
}
Json::Value ResumeCtrl::GetApplicationGlobalProperties(
ApplicationConstSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Json::Value sgp;
DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationGlobalProperties "
- << application->app_id());
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return sgp;
+ }
- Json::Value result;
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();
@@ -820,7 +800,6 @@ Json::Value ResumeCtrl::GetApplicationGlobalProperties(
const smart_objects::SmartObject* menu_title = application->menu_title();
const smart_objects::SmartObject* menu_icon = application->menu_icon();
- Json::Value sgp;
sgp[strings::help_prompt] = JsonFromSO(help_promt);
sgp[strings::timeout_prompt] = JsonFromSO(timeout_prompt);
sgp[strings::vr_help] = JsonFromSO(vr_help);
@@ -829,35 +808,34 @@ Json::Value ResumeCtrl::GetApplicationGlobalProperties(
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) {
- DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationSubscriptions "
- << application->app_id());
-
+ LOG4CXX_AUTO_TRACE(logger_);
Json::Value result;
- std::set<mobile_apis::ButtonName::eType>::iterator it_button ;
- std::set<uint32_t>::iterator it_vehicle;
-
- for (it_button = application->SubscribedButtons().begin() ;
- it_button != application->SubscribedButtons().end(); ++it_button) {
- result[strings::application_buttons].append(*it_button);
- }
- for (it_vehicle = application->SubscribesIVI().begin();
- it_vehicle != application->SubscribesIVI().end(); ++it_vehicle) {
- result[strings::application_vehicle_info].append(*it_vehicle);
+ 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_INFO(logger_, "ResumeCtrl::GetApplicationFiles "
+ LOG4CXX_TRACE(logger_, "ENTER app_id:"
<< application->app_id());
Json::Value result;
@@ -880,8 +858,8 @@ Json::Value ResumeCtrl::GetApplicationFiles(
Json::Value ResumeCtrl::GetApplicationShow(
ApplicationConstSharedPtr application) {
DCHECK(application.get());
- LOG4CXX_INFO(logger_, "ResumeCtrl::GetApplicationShow "
- << application->app_id());
+ LOG4CXX_TRACE(logger_, "ENTER app_id:"
+ << application->app_id());
Json::Value result;
const smart_objects::SmartObject* show_so = application->show_command();
@@ -900,8 +878,9 @@ Json::Value ResumeCtrl::JsonFromSO(const smart_objects::SmartObject *so) {
return temp;
}
-bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObject* request,
+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>(
@@ -918,11 +897,391 @@ bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObject* request,
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) {
+ 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) {
+ 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) {
+ 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));
+ }
+}
+
+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;
+}
+
void ResumeCtrl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject* msg_params, bool use_events) {
-
- NsSmartDeviceLink::NsSmartObjects::SmartObject* result =
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr result =
MessageHelper::CreateModuleInfoSO(function_id);
int32_t hmi_correlation_id =
(*result)[strings::params][strings::correlation_id].asInt();
diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc
index 44ab164538..ad986d2223 100644
--- a/src/components/application_manager/src/usage_statistics.cc
+++ b/src/components/application_manager/src/usage_statistics.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*